make Ox.forEach(object...) return a number; remove Ox.setPropertyOnce; move Ox.last to Array.js; update documentation and tests

This commit is contained in:
rolux 2012-06-02 16:08:01 +02:00
commit ecd84770dd
4 changed files with 104 additions and 90 deletions

View file

@ -31,8 +31,16 @@
};
/*@
Ox.nonblockingForEach <f> Non-blocking forEach with synchronous iterator
Ox.nonblockingForEach <f> Non-blocking `forEach` with synchronous iterator
(col, iterator[, that], callback[, ms]) -> <u> undefined
collection <a|o|s> Collection
iterator <f> Iterator function
value <*> Value
key <n|s> Key
collection <a|o|s> The collection
that <o> The iterator's `this` binding
callback <f> Callback function
ms <n> Number of milliseconds after which to insert a `setTimeout` call
@*/
Ox.nonblockingForEach = function(collection, iterator, that, callback, ms) {
var i = 0, keys, last = Ox.last(arguments),
@ -76,12 +84,13 @@
};
/*@
Ox.nonblockingMap <f> Non-blocking map with synchronous iterator
(collection, iterator[, that]) -> <u> undefined
Ox.nonblockingMap <f> Non-blocking `map` with synchronous iterator
(collection, iterator[, that], callback[, ms]) -> <u> undefined
collection <a|o|s> Collection
iterator <f> Iterator function
that <o> The iterator's this binding
that <o> The iterator's `this` binding
callback <f> Callback function
ms <n> Number of milliseconds after which to insert a `setTimeout` call
<script>
var time = +new Date();
Ox.nonblockingMap(
@ -114,7 +123,7 @@
};
/*@
Ox.parallelForEach <f> forEach with asynchronous iterator, running in parallel
Ox.parallelForEach <f> `forEach` with asynchronous iterator, running in parallel
(collection, iterator[, that], callback) -> <u> undefined
collection <a|o|s> Collection
iterator <f> Iterator function
@ -140,7 +149,7 @@
};
/*@
Ox.parallelMap <f> Parallel map with asynchronous iterator
Ox.parallelMap <f> Parallel `map` with asynchronous iterator
(collection, iterator[, that], callback) -> <u> undefined
collection <a|o|s> Collection
iterator <f> Iterator function
@ -173,7 +182,7 @@
};
/*@
Ox.serialForEach <f> forEach with asynchronous iterator, run serially
Ox.serialForEach <f> `forEach` with asynchronous iterator, run serially
(collection, iterator[, that], callback) -> <u> undefined
collection <a|o|s> Collection
iterator <f> Iterator function
@ -208,7 +217,7 @@
};
/*@
Ox.serialMap <f> Serial map with asynchronous iterator
Ox.serialMap <f> Serial `map` with asynchronous iterator
(collection, iterator[, that], callback) -> <u> undefined
collection <a|o|s> Collection
iterator <f> Iterator function