lag
Functional promises. It's like lodash/underscore for promises.
Using promises as functional values allows the developer to write asynchronous code in a synchronous way.
Method signature
lag.methodName(function, promise_array)
Lag uses the "function first" method signature in order to take advantage of the functional approach to programming.
If you prefer the put the values first and the method second, you can call the lag.promiseFirst()
method to switch the parameter order to lag.methodName(promise_array, function)
.
Install
NPM
npm install lag --save
Bower
bower install lag --save
Example Usage
var _ = ;var xhr = ; var promises = _ _ _; _;
Methods
Arrays
each(fn, promises)
each.series(fn, promises)
map(fn, promises)
map.series(fn, promises)
filter(fn, promises)
filter.series(fn, promises)
reject(fn, promises)
reject.series(fn, promises)
find(fn, promises)
find.series(fn, promises)
reduce(fn, promises)
reduceRight(fn, promises)
first(promises)
first.value(promise)
last(promises)
last.value(promise)
initial(promises)
initial.values(promise)
tail(promises)
tail.values(promise)
reverse(promises)
reverse.values(promise)
compact(promises)
Collections
where(object, promises)
findWhere(object, promises)
pluck(keys, promises)
every(promises)
some(promises)
contains(keys, promises)
Objects
keys(promise)
values(promise)
extend(promise[, object1, objectn, ...])
defaults(defaults[, promise1, promisen, ...])
pick(key1[, keyn, ...], promise)
omit(key1[, keyn, ...], promise)
Nubmers
greaterThan(number, promise)
lessThan(number, promise)
equal(promise1, promise2)
add(number, promise)
subtract(number, promise)
Strings
prepend(promise)
append(promise)
Utilities
promise(function)
asPromise(value)
all(promise1[, promise2, promisen, ...])
when(promise1[, promise2, promisen, ...])
partial(function[, value1, valuen, ...])
boolean(value)
inverseBoolean(value)
compose(method1[, method2, methodn, ...])
Build
npm install
npm run build
Run Tests
npm install
npm test