Ox.noop: call the last (not the first) argument in case it is a function - this way it can be used as an async iterator
This commit is contained in:
parent
a811f29837
commit
ba4086bc55
1 changed files with 7 additions and 5 deletions
|
@ -58,14 +58,16 @@ Ox.cache = function(fn, options) {
|
||||||
Ox.identity <f> Returns its first argument
|
Ox.identity <f> Returns its first argument
|
||||||
This can be used as a default iterator
|
This can be used as a default iterator
|
||||||
@*/
|
@*/
|
||||||
Ox.identity = function(val) {
|
Ox.identity = function(value) {
|
||||||
return val;
|
return value;
|
||||||
};
|
};
|
||||||
|
|
||||||
/*@
|
/*@
|
||||||
Ox.noop <f> Returns undefined and calls optional callback without arguments
|
Ox.noop <f> Returns undefined and calls optional callback without arguments
|
||||||
This can be used to combine a synchronous and an asynchronous code path.
|
This can be used as a default iterator in an asynchronous loop, or to
|
||||||
|
combine a synchronous and an asynchronous code path.
|
||||||
@*/
|
@*/
|
||||||
Ox.noop = function(callback) {
|
Ox.noop = function() {
|
||||||
|
var callback = Ox.last(arguments);
|
||||||
Ox.isFunction(callback) && callback();
|
Ox.isFunction(callback) && callback();
|
||||||
};
|
};
|
||||||
|
|
Loading…
Reference in a new issue