Last change
on this file was 6a3a178, checked in by Ema <ema_spirova@…>, 3 years ago |
initial commit
|
-
Property mode
set to
100644
|
File size:
870 bytes
|
Line | |
---|
1 | 'use strict';
|
---|
2 | var $ = require('../internals/export');
|
---|
3 | var IS_PURE = require('../internals/is-pure');
|
---|
4 | var anObject = require('../internals/an-object');
|
---|
5 | var bind = require('../internals/function-bind-context');
|
---|
6 | var getSetIterator = require('../internals/get-set-iterator');
|
---|
7 | var iterate = require('../internals/iterate');
|
---|
8 |
|
---|
9 | // `Set.prototype.find` method
|
---|
10 | // https://github.com/tc39/proposal-collection-methods
|
---|
11 | $({ target: 'Set', proto: true, real: true, forced: IS_PURE }, {
|
---|
12 | find: function find(callbackfn /* , thisArg */) {
|
---|
13 | var set = anObject(this);
|
---|
14 | var iterator = getSetIterator(set);
|
---|
15 | var boundFunction = bind(callbackfn, arguments.length > 1 ? arguments[1] : undefined, 3);
|
---|
16 | return iterate(iterator, function (value, stop) {
|
---|
17 | if (boundFunction(value, value, set)) return stop(value);
|
---|
18 | }, { IS_ITERATOR: true, INTERRUPTED: true }).result;
|
---|
19 | }
|
---|
20 | });
|
---|
Note:
See
TracBrowser
for help on using the repository browser.