main
Last change
on this file was 79a0317, checked in by stefan toskovski <stefantoska84@…>, 3 days ago |
F4 Finalna Verzija
|
-
Property mode
set to
100644
|
File size:
738 bytes
|
Line | |
---|
1 | 'use strict';
|
---|
2 | var $ = require('../internals/export');
|
---|
3 | var iterate = require('../internals/iterate');
|
---|
4 | var aCallable = require('../internals/a-callable');
|
---|
5 | var anObject = require('../internals/an-object');
|
---|
6 | var getIteratorDirect = require('../internals/get-iterator-direct');
|
---|
7 |
|
---|
8 | // `Iterator.prototype.every` method
|
---|
9 | // https://tc39.es/ecma262/#sec-iterator.prototype.every
|
---|
10 | $({ target: 'Iterator', proto: true, real: true }, {
|
---|
11 | every: function every(predicate) {
|
---|
12 | anObject(this);
|
---|
13 | aCallable(predicate);
|
---|
14 | var record = getIteratorDirect(this);
|
---|
15 | var counter = 0;
|
---|
16 | return !iterate(record, function (value, stop) {
|
---|
17 | if (!predicate(value, counter++)) return stop();
|
---|
18 | }, { IS_RECORD: true, INTERRUPTED: true }).stopped;
|
---|
19 | }
|
---|
20 | });
|
---|
Note:
See
TracBrowser
for help on using the repository browser.