refinable.js    home    ex    api    docs    thy    arch    repo

Build Status

refinable.js is JavaScript library for object-oriented function refinement to implement cross-cutting and feature modularity by extension, mutation, and inheritance of function.

Installing

npm install hiun/refinable

Note : Currently the library is experienmental and possibly unstable.

Prerequisite : Node.js 7.6 or higher (OR 6.5 or higher with --harmony flag for async await)

Simplist Example

API Server

var Behavior = require('self');
var DBQuery = new Behavior.add(inputScaffolding).add(authCheck);
var ReadDBQuery = DBQuery.new().add(cacheCheck);
var WriteDBQuery = DBQuery.new().add(writeBackCheck);

var LoadArticle = ReadDBQuery.new().add(loadQuery);
var CreateArticle = WriteDBQuery.new().add(creationQuery);

LoadArticle.exec(input).then(resp200).catch(resp500);

//using traits
var publicApiTraits = {authCheck: null};
var publicLoadArticle = LoadArticle.new().assign(publicApiTraits);

Refinable functions aspire motivation of many lasting modularity research like aspect-oriented programming and feature-oriented programming by attempting research’s theoretical benefits into pragmatic practices of rising script languages like JavaScript with dependency free implementation mechanism.



Made by hiunEdit this page on GitHub