source: frontend/node_modules/core-js-pure/modules/es.iterator.some.js

Last change on this file was 9af201e, checked in by MBK <marija.karapandzova@…>, 11 days ago

Fix frontend appearance

  • Property mode set to 100644
File size: 1.3 KB
Line 
1'use strict';
2var $ = require('../internals/export');
3var call = require('../internals/function-call');
4var iterate = require('../internals/iterate');
5var aCallable = require('../internals/a-callable');
6var anObject = require('../internals/an-object');
7var getIteratorDirect = require('../internals/get-iterator-direct');
8var iteratorClose = require('../internals/iterator-close');
9var iteratorHelperWithoutClosingOnEarlyError = require('../internals/iterator-helper-without-closing-on-early-error');
10
11var someWithoutClosingOnEarlyError = iteratorHelperWithoutClosingOnEarlyError('some', TypeError);
12
13// `Iterator.prototype.some` method
14// https://tc39.es/ecma262/#sec-iterator.prototype.some
15$({ target: 'Iterator', proto: true, real: true, forced: someWithoutClosingOnEarlyError }, {
16 some: function some(predicate) {
17 anObject(this);
18 try {
19 aCallable(predicate);
20 } catch (error) {
21 iteratorClose(this, 'throw', error);
22 }
23
24 if (someWithoutClosingOnEarlyError) return call(someWithoutClosingOnEarlyError, this, predicate);
25
26 var record = getIteratorDirect(this);
27 var counter = 0;
28 return iterate(record, function (value, stop) {
29 if (predicate(value, counter++)) return stop();
30 }, { IS_RECORD: true, INTERRUPTED: true }).stopped;
31 }
32});
Note: See TracBrowser for help on using the repository browser.