documentation - examples - install - todo - not a real horse

sample
var Manifold = ;var app = ; app; app; app; // => notFound: false path: 'get /user/10' url: '/user/10' match: 'get /user/10' params: _: 'page' page: '10' handle: Function: getUserPage picture: Function: getPicture render: Function: markup
documentation
The module.exports
a constructor
var Manifold = ;
that takes no arguments
var manifold = ;
In all the following node
refers to the object
mapping path to object.
manifold.set([path, props])
set a path to regex mapping for an object
arguments
-
path
type string -
props
type function or plainObject -
when is a function it will be assigned to the
props.handle
-
when is a plainObject, all option properties are passed first to a
parser
if there is one and if not, that property is cloned and assigned to the node props
returns this
The path is taken as a regular expression using the parth module, which uses the usual conventions on for path to regexp parsing. So you know... interesting things can happen.
samples
manifold; manifold;// => notFound: false path: 'get /user/10' url: '/user/10' match: 'get /user/10' params: _: 'page' page: '10' handle: Function: getUserPage
manifold.get([path, options, mod])
get an object matching the given path, clone it if necessary
arguments
path
, optional, type stringoptions
, optional, type object with all extra informationmod
, type object. If is a:- plainObject with property ref, the node found will not be cloned
- regular expression, are the props to skip while cloning
returns the object (cloned/by reference) node
found
In addition, if the node has a parent it will inherit its properties while cloning.
sample
manifold; manifold; manifold; // => notFound: false path: 'get /user/10' url: '/user/10' match: 'get /user/10' params: _: 'page' page: '10' handle: Function: getUserPage picture: Function: getPicture render: Function: markup
instance properties
manifold.regex
: regexes are stored heremanifold.store
: key value store with all of the nodes stored
why
I Need it for the runtime module ;)
The project name is an homage to the concept of manifold. Beautiful creature of Math and Physics thought. BUT, this can't be considered the real thing. That is: this is not a manifold. I'd wish!
install
With npm
npm install manifold --save
examples
Run the example.js
file.
test
$ npm test
➜ manifold (master) ✓ npm test
manifold
sample
✓ data creation should not fail
✓ sample data should be random
parse
✓ add test data
✓ should parse properties when one sets them
✓ should support objects for setting parsers
rootNode
✓ add test data
✓ should have properties ({ref: true})
✓ should have properties ({ref: true})
✓ should not have properties ({ref: true})
✓ should have properties ({ref: true})
parent
✓ add test data
✓ should have children added after parent is set
✓ should have the same parent by reference
✓ property should not be enumerable after overwrite
children
✓ add test data
✓ should support single object as input
✓ should support array as input
✓ should have parent added after children were set
✓ should not be enumerable after overwrite
✓ should inherit from parent when
20 passing (35ms)