Given an object, get the "Symbol.iterator" element, throw a TypeError if it
is not present, then call the result, (throwing a TypeError if the result is
not a function), and return that result, whatever it is.
489665
public static Object callIterator(Object obj, Context cx, Scriptable scope)
    {
        final Callable getIterator =
                ScriptRuntime.getElemFunctionAndThis(obj, SymbolKey.ITERATOR, cx, scope);
        final Scriptable iterable = ScriptRuntime.lastStoredScriptable(cx);
        return getIterator.call(cx, scope, iterable, ScriptRuntime.emptyArgs);
    }
401891
function (iterator, context) {
        return _.map(this.members, _.isFunction(iterator) ? iterator.bind(context || this) : iterator);
    }
1353247
function starx(obj) {
    if (!isGenerator(obj) && !isIterator(obj)) throw new TypeError('obj must be a generator or iterator')

    return function executor(done) {
      var self = this,
          done = once(done || noop),
          iterator = isGenerator(obj) ? obj.call(self) : obj

      process.nextTick(next)
      function next(err, value) {    
        var res, _next = once(next)

        domain.create()
          // iterator throws, we're done
          .on('error', done)
          .run(function() {
            res = err ? iterator.throw(err) : iterator.next(value)
          })
      
        domain.create()
          // yieldable throws, iterator is certainly not yet exhausted, so run next
          .on('error', _next)
          .run(function() {
            wrap.call(self, res.value).call(self, function cb() {
              (res.done ? done : _next).apply(null, arguments)
            })
          })
      }
    }
  }
526026
function assertError(result, error) {
  if (typeof error === 'function') {
    if (!(result instanceof error || error(result) === true)) {
      throw result
    }
  } else if (typeof error === 'string') {
    assert(result.message.includes(error), 'Error message is incorrect')
  } else if (error instanceof RegExp) {
    assert(
      error.test(result.message),
      `Expected ${result.message} to match ${error}`,
    )
  } else {
    invariant(
      typeof error === 'boolean',
      'The given `error` must be a function, string, boolean, or RegExp',
    )
  }
}
566640
def _wrap_result(self, func):
        
        def wrapper(*args):
            result = func(*args)
            if hasattr(result, '__iter__') and not isinstance(result, etree._Element):
                return [self._wrap_element(element) for element in result]
            else:
                return self._wrap_element(result)
        return wrapper
350325
def any(cls, result_key, func):
        
        def scanner(self, obj):
            current_value = getattr(self, result_key, None)
            setattr(self, result_key, current_value or func(obj))

        cls._scan(result_key, scanner)
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);
            }
        }
    }
705740
function(err) {
		/**
		 * If err is an Error object, break the chain and call catch
		 */
		if (err && (err.constructor.name === "Error" || err.constructor.name === "TypeError") && this.onCatch) {
			this.onCatch(err);
			return;
		}

		var nextFn = this.fnStack.shift();
		if (nextFn) {
			/**
			 * Ensure arguments are passed as an Array
			 */
			var args = Array.prototype.slice.call(arguments);
			return this.execute(nextFn.fn, args);
		}
	}
1218033
@Override
    protected Iterator<?> getJavaIterator(Context cx, Scriptable scope, Object obj) {
        if (obj instanceof Wrapper) {
            Object unwrapped = ((Wrapper) obj).unwrap();
            Iterator<?> iterator = null;
            if (unwrapped instanceof Iterator)
                iterator = (Iterator<?>) unwrapped;
            if (unwrapped instanceof Iterable)
                iterator = ((Iterable<?>)unwrapped).iterator();
            return iterator;
        }
        return null;
    }
1339937
function objectGet(obj, path, throwError) {
  var paths = isArray(path) ? path : path.split('.');
  var current = obj;

  try {
    var _iteratorNormalCompletion2 = true;
    var _didIteratorError2 = false;
    var _iteratorError2 = undefined;

    try {
      for (var _iterator2 = paths[Symbol.iterator](), _step2; !(_iteratorNormalCompletion2 = (_step2 = _iterator2.next()).done); _iteratorNormalCompletion2 = true) {
        var key = _step2.value;
        current = current[key];
      }
    } catch (err) {
      _didIteratorError2 = true;
      _iteratorError2 = err;
    } finally {
      try {
        if (!_iteratorNormalCompletion2 && _iterator2.return != null) {
          _iterator2.return();
        }
      } finally {
        if (_didIteratorError2) {
          throw _iteratorError2;
        }
      }
    }
  } catch (e) {
    if (throwError) {
      throw "Path does not exist";
    }
  }

  return current;
}
911090
@SuppressWarnings("unchecked")
  public static Iterator<Object> iterator(Object iterable) {
    Assert.state(isIterable(iterable.getClass()));
    return iterable.getClass().isArray() ? new ArrayIterator(iterable)
        : ((Iterable<Object>) iterable).iterator();
  }
170906
function () {
          if (this === global || !exists(this)) {
            throw new TypeError('this is null or not defined for ' + method)
          }
          var args = Array.prototype.slice.call(arguments)
          args.unshift(this) // sets first arg as object instance
          return method.apply(this, args)
        }
251654
function check(locator) {
  if (locator instanceof By || typeof locator === 'function') {
    return locator;
  }

  if (locator
      && typeof locator === 'object'
      && typeof locator.using === 'string'
      && typeof locator.value === 'string') {
    return new By(locator.using, locator.value);
  }

  for (let key in locator) {
    if (locator.hasOwnProperty(key) && By.hasOwnProperty(key)) {
      return By[key](locator[key]);
    }
  }
  throw new TypeError('Invalid locator');
}
750982
function(items, iterator, done) {
    done = done || function() {};
    var results = [];
    var failure = false;
    var expected = items.length;
    var current = -1;

    function callback(err, result) {
      if (err) return done(err);

      results.push(result);

      if (current == expected) {
        return done(null, results);
      } else {
        next();
      }
    }

    function next() {
      current += 1;

      var item = items[current];
      iterator(item, callback);
    }

    next()
  }
910672
function map(obj, iterator, context) {
		var results = [], i, j;

		if (!obj) return results;

		// Use native .map method if it exists:
		if (nativeMap && obj.map === nativeMap) return obj.map(iterator, context);

		// Fallback for native .map:
		for (i = 0, j = obj.length; i < j; i++ ) {
			results[i] = iterator.call(context, obj[i], i, obj);
		}
		return results;
	}
740621
function _checkResult(type, err, obj, options)
{
    if (options) {
        if (options.logger) logger.logger(options.logger, 'parse:', type, options, lib.traceError(err), obj);
        if (options.datatype == "object" || options.datatype == "obj") return {};
        if (options.datatype == "list") return [];
        if (options.datatype == "str") return "";
    }
    return null;
}
1202764
function(object, callback) {
      return inject(object, null, function(state, key, value){
        if (state == undefined)
          return callIterator(callback, key, value) ? value : state
      })
    }