UNPKG

517 BJavaScriptView Raw
1'use strict';
2// https://github.com/tc39/proposal-iterator-helpers
3var $ = require('../internals/export');
4var iterate = require('../internals/iterate');
5var aFunction = require('../internals/a-function');
6var anObject = require('../internals/an-object');
7
8$({ target: 'Iterator', proto: true, real: true }, {
9 find: function find(fn) {
10 anObject(this);
11 aFunction(fn);
12 return iterate(this, function (value) {
13 if (fn(value)) return iterate.stop(value);
14 }, undefined, false, true).result;
15 }
16});