travis-ci
1461 of 1662 branches covered (87.91%)
Branch coverage included in aggregate %.
29 of 29 new or added lines in 1 file covered. (100.0%)
5405 of 6152 relevant lines covered (87.86%)
388402.32 hits per line
1 |
import ISequence from '../dataTypes/ISequence'; |
|
2 |
import sequenceFactory from '../dataTypes/sequenceFactory'; |
3✔ |
3 |
|
|
4 |
export default function createDoublyIterableSequence(sequence: ISequence): () => ISequence { |
3✔ |
5 |
const savedValues = [];
|
79,719✔ |
6 |
const backingIterator = sequence.value;
|
79,719✔ |
7 |
return () => {
|
79,719✔ |
8 |
let i = 0;
|
189,894✔ |
9 |
return sequenceFactory.create({
|
189,894✔ |
10 |
next: () => {
|
|
11 |
if (savedValues[i] !== undefined) {
|
|
12 |
return savedValues[i++];
|
219,584✔ |
13 |
} |
|
14 |
const val = backingIterator.next();
|
362,621✔ |
15 |
if (!val.ready) {
|
|
16 |
return val;
|
× |
17 |
} |
|
18 |
if (val.done) {
|
|
19 |
return val;
|
115,114✔ |
20 |
} |
|
21 |
savedValues[i++] = val; |
247,505✔ |
22 |
return val;
|
247,505✔ |
23 |
} |
|
24 |
}); |
|
25 |
}; |
|
26 |
} |