(array)
| 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]); |
no outgoing calls
no test coverage detected
searching dependent graphs…