while(iterator) {
    // If false is returned (and the cursor was not manually advanced), we set
    // the preempt flag to signal that the last result (the `false` value)
    // should be removed from the resulting array.
    let preempt = false;

    /**
     * The Cursor instance that `#iterate` passes to `iterator`, hoisted so
     * that we may also hoist `autoAdvancer`.
     * @type {?Cursor}
     */
    let cursor;

    /**
     * We wrap our iterator, calling `Cursor#continue` if the cursor is not
     * manually advanced and `result` is not `false`.
     * @param {*|false} result
     * @return {*}
     */
    const autoAdvancer = (result) => {
      if (this._cursorRequest.readyState === 'done') {
        if (result === false) {
          preempt = true;
        } else {
          cursor.continue();
        }
      }

      return result;
    };

    return this.iterate((c) => {
      cursor = c;
      return SyncPromise.resolve(iterator(cursor))
        .then(autoAdvancer);
    }).then((results) => {
      // If we preempted iteration (by returning `false` and not manually
      // advancing the cursor), we need to remove that final `false` value from
      // the resolved results.
      if (preempt) {
        results.pop();
      }

      return results;
    });
  }
/**
   * Iterates the cursor, calling `iterator` ever time the cursor advances to a
   * new record. The iterator may optionally advance the cursor. If it does
   * not, the cursor will be automatically advanced to the next record as long
   * as the iterator's result is not `false` (which signals that iteration
   * should stop). If you wish to continue iteration _and_ return `false`, you
   * must manually advance the cursor.
   *
   * @param {!function(!Cursor):*} iterator
   * @return {!SyncPromise<Array<*>>} A Promise-like that will resolve to the
   *     values returned from `iterator` at every iteration.
   */
Iterates the cursor, calling `iterator` ever time the cursor advances to a
new record. The iterator may optionally advance the cursor. If it does
not, the cursor will be automatically advanced to the next record as long
as the iterator's result is not `false` (which signals that iteration
should stop). If you wish to continue iteration _and_ return `false`, you
must manually advance the cursor.

@param {!function(!Cursor):*} iterator
@return {!SyncPromise>} A Promise-like that will resolve to the
values returned from `iterator` at every iteration.
Iterates the cursor calling ` iterator ` ever time the cursor advances to a new record . The iterator may optionally advance the cursor . If it does not the cursor will be automatically advanced to the next record as long as the iterator ' s result is not ` false ` ( which signals that iteration should stop ) . If you wish to continue iteration _and_ return ` false ` you must manually advance the cursor . @param { !function ( !Cursor ) : * } iterator @return { !SyncPromise > } A Promise - like that will resolve to the values returned from ` iterator ` at every iteration .
while(iterator) {
    let preempt = false;
    let cursor;
    const autoAdvancer = (result) => {
      if (this._cursorRequest.readyState === 'done') {
        if (result === false) {
          preempt = true;
        } else {
          cursor.continue();
        }
      }
      return result;
    };
    return this.iterate((c) => {
      cursor = c;
      return SyncPromise.resolve(iterator(cursor))
        .then(autoAdvancer);
    }).then((results) => {
      if (preempt) {
        results.pop();
      }
      return results;
    });
  }
while ( iterator ) { let preempt = false ; let cursor ; const autoAdvancer = ( result ) => { if ( this . _cursorRequest . readyState === 'done' ) { if ( result === false ) { preempt = true ; } else { cursor . continue ( ) ; } } return result ; } ; return this . iterate ( ( c ) => { cursor = c ; return SyncPromise . resolve ( iterator ( cursor ) ) . then ( autoAdvancer ) ; } ) . then ( ( results ) => { if ( preempt ) { results . pop ( ) ; } return results ; } ) ; }
Iterates the cursor, calling `iterator` ever time the cursor advances to a
 new record.
Iterates the cursor calling ` iterator ` ever time the cursor advances to a new record .
// If false is returned (and the cursor was not manually advanced), we set // the preempt flag to signal that the last result (the `false` value) // should be removed from the resulting array. /**
     * The Cursor instance that `#iterate` passes to `iterator`, hoisted so
     * that we may also hoist `autoAdvancer`.
     * @type {?Cursor}
     */ /**
     * We wrap our iterator, calling `Cursor#continue` if the cursor is not
     * manually advanced and `result` is not `false`.
     * @param {*|false} result
     * @return {*}
     */ // If we preempted iteration (by returning `false` and not manually // advancing the cursor), we need to remove that final `false` value from // the resolved results.