-
Notifications
You must be signed in to change notification settings - Fork 0
Condition Chain
Malexion edited this page Nov 6, 2016
·
2 revisions
-
valueSets the base initial value for the chain to operate on.
Note: Many function names/operations subject to change.
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);