src/third_party/mozjs/extract/js/src/builtin/Iterator.js
/* Iterator Helpers proposal 2.1.5.4 Body */
Iterator Helpers proposal 2.1.5.4 Body
Iterator Helpers proposal 2 . 1 . 5 . 4 Body
function* IteratorTakeGenerator(iterated, remaining) {
  let lastValue;
  let needClose = true;
  try {
    yield;
    needClose = false;
    for (; remaining > 0; remaining--) {
      const next = IteratorStep(iterated, lastValue);
      if (!next) {
        return;
      }
      const value = next.value;
      needClose = true;
      lastValue = yield value;
      needClose = false;
    }
  } finally {
    if (needClose) {
      IteratorClose(iterated);
    }
  }
  IteratorClose(iterated);
}
function * IteratorTakeGenerator ( iterated , remaining ) { let lastValue ; let needClose = true ; try { yield ; needClose = false ; for ( ; remaining > 0 ; remaining -- ) { const next = IteratorStep ( iterated , lastValue ) ; if ( ! next ) { return ; } const value = next . value ; needClose = true ; lastValue = yield value ; needClose = false ; } } finally { if ( needClose ) { IteratorClose ( iterated ) ; } } IteratorClose ( iterated ) ; }
Iterator Helpers proposal 2.1.5.4 Body
Iterator Helpers proposal 2 . 1 . 5 . 4 Body
// Step 1. // Step 2.