0.5.3 • Published 9 years ago
cerebral-url-scheme-compiler v0.5.3
cerebral-url-scheme-compiler 
The url scheme compiler for Cerebral
getCompiler
converts a path URL into an efficient getter function
import getCompiler from 'cerebral-url-scheme-compiler/get';
// some action factory
export default function (fromPath) {
// "compile" the fromPath into a getValue function
const getValue = getCompiler(fromPath);
// return an action
return function myAction (args) {
let value = getValue(args);
// do something with value ...
}
}setCompiler
converts a path URL into an efficient setter function
import setCompiler from 'cerebral-url-scheme-compiler/set';
// some action factory
export default function (toPath) {
// "compile" the toPath into a setValue function
const setValue = setCompiler(toPath);
// return an action
return function myAction (args) {
// do something to get the value
setValue(args, value);
}
}Contribute
Fork repo
npm installnpm startruns dev mode which watches for changes and auto lints, tests and buildsnpm testruns the testsnpm run lintlints the codenpm run buildcompiles es6 to es5