MCPcopy
hub / github.com/caolan/async / makeIterator

Function makeIterator

mocha_test/filter.js:57–71  ·  view source on GitHub ↗
(array)

Source from the content-addressed store, hash-verified

55
56 if (typeof Symbol === 'function' && Symbol.iterator) {
57 function makeIterator(array){
58 var nextIndex;
59 let iterator = {
60 next: function(){
61 return nextIndex < array.length ?
62 {value: array[nextIndex++], done: false} :
63 {done: true};
64 }
65 };
66 iterator[Symbol.iterator] = function() {
67 nextIndex = 0; // reset iterator
68 return iterator;
69 };
70 return iterator;
71 }
72
73 it('filter iterator', function(done){
74 var a = makeIterator([500, 20, 100]);

Callers 1

filter.jsFile · 0.85

Calls

no outgoing calls

Tested by

no test coverage detected

Used in the wild real call sites across dependent graphs

searching dependent graphs…