bloody-collections
Advanced tools
Comparing version 0.4.1 to 0.5.0
@@ -19,2 +19,3 @@ module.exports = { | ||
, range : require("./lib/range") | ||
, iterator : require("./lib/iterator") | ||
} |
@@ -5,3 +5,3 @@ { | ||
"issues" : "https://github.com/bloodyowl/collections/issues", | ||
"version" : "0.4.1", | ||
"version" : "0.5.0", | ||
"scripts" : { | ||
@@ -8,0 +8,0 @@ "test" : "tape test/*.js" |
@@ -179,1 +179,18 @@ # collections | ||
``` | ||
### `iterator(array) -> fn` | ||
Returns a function that returns the next element in the array every time it is called. | ||
Works with sparse arrays. | ||
```javascript | ||
var array = [1,2,3] | ||
, fn = iterator(array) | ||
fn() // 1 | ||
fn() // 2 | ||
array.push(4) | ||
fn() // 3 | ||
fn() // 4 | ||
fn() // null | ||
``` |
29462
44
853
196