TODO: discuss convention for iterator function signatures. trying to achieve a combination of underscore and node.js callback style
431428
function arrayFunction(item, index) {
      return function(data, cb) {
        if (iterator.length === 2) {
          iterator(item, cb);
        } else if (iterator.length === 3) {
          iterator(item, index, cb);
        } else {
          iterator(item, index, data, cb);
        }
      };
    }
1064153
function() {
            // ever notice we do this sort thing lots?
            var args = [].slice.call(arguments)
            ,   tmpl = args.shift()
            ,   last = args[args.length - 1]
            ,   qs   = tmpl.match(/\?/g)
            ,   q    = qs && qs.length > 0 ? interpolate(tmpl, args.slice(0, qs.length)) : tmpl
            ,   is   = new Function(this.record, 'return !!(' + q + ')')
            ,   r    = []
            ,   cb
            // iterate the entire collection
            // TODO should we allow for chained where() to filter __results? (I'm thinking no b/c creates funny behvaiors w/ callbacks)
            this.all(function(all){
                for (var i = 0, l = all.length; i < l; i++) {
                    if (is.call(all[i], all[i])) r.push(all[i])
                }
                // overwrite working results
                this.__results = r
                // callback / chain
                if (args.length === 1) this.fn(this.name, last).call(this, this.__results)   
            })
            return this 
        }
754574
function iteratorFactory(callback) {
  return iterator

  function iterator(parent) {
    var children = parent && parent.children

    if (!children) {
      throw new Error('Missing children in `parent` for `modifier`')
    }

    return iterate(children, callback, parent)
  }
}
1009388
function iter(obj, each) {
  if (!obj || typeof obj !== 'object') { return ''; }

  let output = '';
  const keys = Object.keys(obj);
  const length = keys.length;

  for (let i = 0; i < length; i += 1) {
    const key = keys[i];
    output += each(key, i, length, obj[key]);
  }

  return output;
}
667521
function iterator(iterId, conn) {
      var nextElems = [];
      var done = false;

      function nextPromise() {
        var kv = nextElems.pop();
        return new Promise(function (fulfill, reject) {
          fulfill(f.merge({done: done}, kv));
        });
      }

      function donePromise() {
        return new Promise(function (fulfill, reject) {
          fulfill({done: done});
        });
      }

      return {
        /**
         * Iterator next object returned from completed Iterator.next() calls.
         *
         * @typedef {Object} IteratorNext
         * @property {?(String|Object)} key -
         * If iteration not done, entry's key, otherwise undefined.
         * @property {?(String|Object)} value -
         * If iteration not done, entry's value, otherwise undefined.
         * @property {Boolean} done -
         * Indicates whether iteration has been completed.
         * When true, key and value will be undefined.
         * When false, key and value will be non-null.
         * @since 0.3
         */
        /**
         * Returns the next entry being iterated over.
         *
         * @returns {module:promise.Promise.<IteratorNext>}
         * It returns a Promise which will be completed with an instance that
         * provides the next element.
         * @memberof Iterator#
         * @since 0.3
         */
        next: function() {
          if (done) {
            logger.tracef('Iterator(iteratorId=%s) already exhausted', iterId);
            return donePromise();
          } else if (_.isEmpty(nextElems)) {
            var ctx = u.context(SMALL);
            logger.tracef(
                'Invoke iterator.next(msgId=%d,iteratorId=%s) on %s'
                , ctx.id, iterId, conn.toString()
            );
            var remote = futurePinned(ctx, 0x33, p.encodeIterId(iterId), p.decodeNextEntries(), conn);
            return remote.then(function(entries) {
              if (_.isEmpty(entries)) {
                done = true;
                return donePromise();
              } else {
                _.each(entries, function(entry) {
                  nextElems.push(entry);
                });
                return nextPromise();
              }
            });
          }
          logger.tracef('Return next from locally cached entries for iterator(iteratorId=%s)', iterId);
          return nextPromise();
        },
        /**
         * Close the iteration.
         *
         * @returns {module:promise.Promise}
         * A Promise which will be completed once the iteration has been closed.
         * @memberof Iterator#
         * @since 0.3
         */
        close: function() {
          var ctx = u.context(SMALL);
          logger.debugf('Invoke iterator.close(msgId=%d,iteratorId=%s) on %s', ctx.id, iterId, conn.toString());
          return futurePinned(
              ctx, 0x35, p.encodeIterId(iterId), p.complete(p.hasSuccess), conn);
        }
      }
    }
711002
function iterator(entry, nextIterator) {

        var url = entry.request.url;

        var isLocalUserEntryFile = url.indexOf(options.resourceDomainBase + '/user-entry.js') === 0;
        var isNotBootstrapFiles = url.indexOf(options.resourceDomainBase) !== 0;
        var isServedZipContent = url.indexOf(options.resourceDomainBase + '/zip') === 0;


        // filter out internals
        var isExternalContent =
            url.indexOf('http') === 0 &&
            (isLocalUserEntryFile || isServedZipContent || isNotBootstrapFiles) &&
            url.indexOf('es5-shim.min.js') < 0;

        if (isExternalContent !== true){
            return nextIterator();
        }

        var responseCounter = 2;
        var output = {
            'time': entry.request.time,
            'url': url
        };

        if (harConfig.checkTls && isLocalUserEntryFile !== true && isServedZipContent !== true) {
            responseCounter += 1;
            request(url.replace(/^http:/i,'https:'), requestOptions, tlsHandler);
        }


        request(url, requestOptions, gzipHandler);
        request(url, requestOptionsWithoutGzip, rawHandler);

        function done(err) {
            if (err){
                // errors here might come from gzip or raw handler -
                output.requestError = true;
                output.error = err;
            }

            responseCounter--;
            if (responseCounter <= 0) {
                rawFileData[url] = output;
                nextIterator();
            }
        }

        function tlsHandler(err, res) {
            if (err){
                output.validTls = false;
                output.tlsErrorMessage = err.message;
                output.tlsResponseCode = res && res.statusCode;
                return done();
            }

            output.validTls = !(res && res.statusCode >= 400);
            output.tlsResponseCode = res.statusCode;

            done();
        }

        function rawHandler(err, res, body) {

            if (err || !body){
                return done(err);
            }

            if (res && res.statusCode >= 400){
                return done(new Error('Request error'));
            }

            output.base64Content = body.toString('base64');
            output.unzippedSize = body.length;

            // find compression target
            zlib.gzip(body, function (err, buffer) {
                var compressionPossible = body.length - buffer.length;

                //entry.response.content.compression = compressionPossible;
                output.aproxCompressionPossible = compressionPossible;
                output.aproxCompressedSize = buffer.length;

                done();
            });
        }

        function gzipHandler(err, res, body) {

            if (err || !body){
                //console.log('gzipHandler', err);
                return done(err);
            }

            if (res && res.statusCode >= 400){
                return done(new Error('Request error'));
            }

            // HAr correction phantom sizes are buggy at best.
            // entry.response.bodySize = body.length;
            // entry.response.content.size = body.length;

            output.redirects = res.request.redirects;
            output.contentType = res.headers['content-type'];
            output.contentLength = res.headers['content-length'];
            output.bodyLength = body.length;

            var encoding = res.headers['content-encoding'];
            output.compressed = !! (encoding && (/gzip/i).test(encoding));

            done();
        }

    }
1163151
function each(object, callback) {
    var index = -1,
        length = object ? object.length : 0;

    if (typeof length == 'number' && length > -1 && length <= maxSafeInteger) {
      while (++index < length) {
        callback(object[index], index, object);
      }
    } else {
      forOwn(object, callback);
    }
  }
1094650
function each(iterator) {
    for (var i = 0, length = this.length; i < length; i++)
      iterator(this[i]);
  }
618400
function createIteratorForKey(object, k) {
  const v = object[k];

  if (v instanceof Set) {
    const iterator = v.values();

    return new Iterator(function() {
      const step = iterator.next();

      if (step.done)
        return step;

      const edgeData = step.value;

      return {
        done: false,
        value: [
          edgeData.key,
          edgeData.attributes,
          edgeData.source.key,
          edgeData.target.key,
          edgeData.source.attributes,
          edgeData.target.attributes
        ]
      };
    });
  }

  return Iterator.of([
    v.key,
    v.attributes,
    v.source.key,
    v.target.key,
    v.source.attributes,
    v.target.attributes
  ]);
}
1004824
function iterable (data) {
    if (! haveSymbols) {
      // Fall back to `arrayLike` predicate in pre-ES6 environments.
      return arrayLike(data);
    }

    return assigned(data) && isFunction(data[Symbol.iterator]);
  }
1198438
function Iterator(array) {

    // the array and current slot index are private attributes so methods that use them
    // are defined in the constructor
    var currentSlot = 0;  // the slot before the first item

    this.toStart = function() {
        currentSlot = 0;  // the slot before the first item
    };

    this.toSlot = function(slot) {
        const size = array.length;
        if (slot > size) slot = size;
        if (slot < -size) slot = -size;
        if (slot < 0) slot = slot + size + 1;
        currentSlot = slot;
    };

    this.toEnd = function() {
        currentSlot = array.length;  // the slot after the last item
    };

    this.hasPrevious = function() {
        return currentSlot > 0;
    };

    this.hasNext = function() {
        return currentSlot < array.length;
    };

    this.getPrevious = function() {
        if (!this.hasPrevious()) return;
        return array[--currentSlot];
    };

    this.getNext = function() {
        if (!this.hasNext()) return;
        return array[currentSlot++];
    };

    return this;
}
1208625
function forEach(iterable, callback) {
    for (var i = 0; i < iterable.length; i++) {
        callback(iterable[i], i);
    }
}
30349
function(iter) {

        var front = null, back = null;

        return _esdown.computed({

            next: function(val) { return send("next", val) },
            throw: function(val) { return send("throw", val) },
            return: function(val) { return send("return", val) },
            }, Symbol.asyncIterator, { _: function() { return this },
        });

        function send(type, value) {

            return new Promise(function(resolve, reject) {

                var x = { type: type, value: value, resolve: resolve, reject: reject, next: null };

                if (back) {

                    // If list is not empty, then push onto the end
                    back = back.next = x;

                } else {

                    // Create new list and resume generator
                    front = back = x;
                    resume(type, value);
                }
            });
        }

        function fulfill(type, value) {

            switch (type) {

                case "return":
                    front.resolve({ value: value, done: true });
                    break;

                case "throw":
                    front.reject(value);
                    break;

                default:
                    front.resolve({ value: value, done: false });
                    break;
            }

            front = front.next;

            if (front) resume(front.type, front.value);
            else back = null;
        }

        function awaitValue(result) {

            var value = result.value;

            if (typeof value === "object" && "_esdown_await" in value) {

                if (result.done)
                    throw new Error("Invalid async generator return");

                return value._esdown_await;
            }

            return null;
        }

        function resume(type, value) {

            // HACK: If the generator does not support the "return" method, then
            // emulate it (poorly) using throw.  (V8 circa 2015-02-13 does not support
            // generator.return.)
            if (type === "return" && !(type in iter)) {

                type = "throw";
                value = { value: value, __return: true };
            }

            try {

                var result$1 = iter[type](value),
                    awaited$0 = awaitValue(result$1);

                if (awaited$0) {

                    Promise.resolve(awaited$0).then(
                        function(x) { return resume("next", x); },
                        function(x) { return resume("throw", x); });

                } else {

                    Promise.resolve(result$1.value).then(
                        function(x) { return fulfill(result$1.done ? "return" : "normal", x); },
                        function(x) { return fulfill("throw", x); });
                }

            } catch (x) {

                // HACK: Return-as-throw
                if (x && x.__return === true)
                    return fulfill("return", x.value);

                fulfill("throw", x);
            }
        }
    }
639217
function createEdgeIteratorForNode(type, direction, nodeData) {
  let iterator = Iterator.empty();

  if (type !== 'undirected') {
    if (direction !== 'out' && typeof nodeData.in !== 'undefined')
      iterator = chain(iterator, createIterator(nodeData.in));
    if (direction !== 'in' && typeof nodeData.out !== 'undefined')
      iterator = chain(iterator, createIterator(nodeData.out));
  }

  if (type !== 'directed' && typeof nodeData.undirected !== 'undefined') {
    iterator = chain(iterator, createIterator(nodeData.undirected));
  }

  return iterator;
}
999282
function(items, iterator, done) {
    done = done || function() {};
    var results = [];
    var failure = false;
    var expected = items.length;
    var actual = 0;
    var createIntermediary = function(index) {
      return function(err, result) {
        // Return if we found a failure anywhere.
        // We can't stop execution of functions since they've already
        // been fired off; but we can prevent excessive handling of callbacks.
        if (failure != false) {
          return;
        }

        if (err != null) {
          failure = true;
          done(err, result);
          return;
        }

        actual += 1;

        if (actual == expected) {
          done(null, results);
        }
      };
    };

    for (var i = 0; i < items.length; i++) {
      var item = items[i];
      iterator(item, createIntermediary(i));
    }

    if (items.length == 0) {
      done(null, []);
    }
  }
1073883
function scrape(iterator, data, params, cb) {
    var $ = artoo.$,
        scraped = [],
        loneSelector = !!data.attr || !!data.method || data.scrape ||
                       typeof data === 'string' ||
                       typeof data === 'function';

    params = params || {};

    // Transforming to selector
    var $iterator;
    if (typeof iterator === 'function')
      $iterator = $(iterator($));
    else
      $iterator = $(iterator);

    // Iteration
    $iterator.each(function(i) {
      var item = {},
          p;

      // TODO: figure iteration scope elsewhere for scrape recursivity
      if (loneSelector)
        item = (typeof data === 'object' && 'scrape' in data) ?
          scrape(
            (data.sel ? $(this).find(data.sel) : $(this))
              .find(data.scrape.iterator),
            data.scrape.data,
            data.scrape.params
          ) :
          step(data, this);
      else
        for (p in data) {
          item[p] = (typeof data[p] === 'object' && 'scrape' in data[p]) ?
            scrape(
              (data[p].sel ? $(this).find(data[p].sel) : $(this))
                .find(data[p].scrape.iterator),
              data[p].scrape.data,
              data[p].scrape.params
            ) :
            step(data[p], this);
        }

      scraped.push(item);

      // Breaking if limit i attained
      return !params.limit || i < params.limit - 1;
    });

    scraped = params.one ? scraped[0] : scraped;

    // Triggering callback
    if (typeof cb === 'function')
      cb(scraped);

    // Returning data
    return scraped;
  }
1271914
function shallowEqualWithoutReactElements(thisProps, nextProps) {
    var equals = false;
    if (thisProps === nextProps) {
        equals = true;
    } else if ((typeof thisProps === 'undefined' ? 'undefined' : _typeof(thisProps)) === 'object' && (typeof nextProps === 'undefined' ? 'undefined' : _typeof(nextProps)) === 'object') {
        equals = true;
        var propNames = new Set(Object.keys(thisProps), Object.keys(nextProps));
        var _iteratorNormalCompletion = true;
        var _didIteratorError = false;
        var _iteratorError = undefined;

        try {
            for (var _iterator = propNames[Symbol.iterator](), _step; !(_iteratorNormalCompletion = (_step = _iterator.next()).done); _iteratorNormalCompletion = true) {
                var propName = _step.value;

                if (thisProps[propName] !== nextProps[propName] && !isReactElement(thisProps[propName])) {
                    // No need to check nextProps[propName] as well, as we know they are not equal
                    equals = false;
                    break;
                }
            }
        } catch (err) {
            _didIteratorError = true;
            _iteratorError = err;
        } finally {
            try {
                if (!_iteratorNormalCompletion && _iterator.return) {
                    _iterator.return();
                }
            } finally {
                if (_didIteratorError) {
                    throw _iteratorError;
                }
            }
        }
    }
    return equals;
}