MCPcopy
hub / github.com/immutable-js/immutable-js / next

Method next

src/Map.js:631–666  ·  view source on GitHub ↗
()

Source from the content-addressed store, hash-verified

629 }
630
631 next() {
632 const type = this._type;
633 let stack = this._stack;
634 while (stack) {
635 const node = stack.node;
636 const index = stack.index++;
637 let maxIndex;
638 if (node.entry) {
639 if (index === 0) {
640 return mapIteratorValue(type, node.entry);
641 }
642 } else if (node.entries) {
643 maxIndex = node.entries.length - 1;
644 if (index <= maxIndex) {
645 return mapIteratorValue(
646 type,
647 node.entries[this._reverse ? maxIndex - index : index]
648 );
649 }
650 } else {
651 maxIndex = node.nodes.length - 1;
652 if (index <= maxIndex) {
653 const subNode = node.nodes[this._reverse ? maxIndex - index : index];
654 if (subNode) {
655 if (subNode.entry) {
656 return mapIteratorValue(type, subNode.entry);
657 }
658 stack = this._stack = mapIteratorFrame(subNode, stack);
659 }
660 continue;
661 }
662 }
663 stack = this._stack = this._stack.__prev;
664 }
665 return iteratorDone();
666 }
667}
668
669function mapIteratorValue(type, entry) {

Callers 15

__iteratorMethod · 0.80
__iteratorMethod · 0.80
__iteratorMethod · 0.80
flipFactoryFunction · 0.80
mapFactoryFunction · 0.80
reverseFactoryFunction · 0.80
filterFactoryFunction · 0.80
sliceFactoryFunction · 0.80
takeWhileFactoryFunction · 0.80
skipWhileFactoryFunction · 0.80
__iterateUncachedMethod · 0.80
__iteratorUncachedMethod · 0.80

Calls 3

iteratorDoneFunction · 0.90
mapIteratorValueFunction · 0.85
mapIteratorFrameFunction · 0.85

Tested by

no test coverage detected