Skip to content

Condition Chain

Malexion edited this page Nov 6, 2016 · 2 revisions

__.lib.ConditionChain(value)

  • value Sets the base initial value for the chain to operate on.

Note: Many function names/operations subject to change.

Examples

var target = [
   { name: 'sally', income: 200000 }, 
   { name: 'jill', income: 10000 }, 
   { name: 'frank', income: 2000 },
   { name: 'foobar', income: 100000000 }
];
var result = new __.lib.ConditionChain(target) // same as __.flow() though with less letters
               .isArray()
               .sort({ dir: 'desc', key: x => x.income })
               .map(x => x.name)
               .filter(x => x.contains('a'))
               .value([]); // param for default if not set

console.log(result);

Clone this wiki locally