esnext.set.some.js 654 B

1234567891011121314151617
  1. 'use strict';
  2. var $ = require('../internals/export');
  3. var bind = require('../internals/function-bind-context');
  4. var aSet = require('../internals/a-set');
  5. var iterate = require('../internals/set-iterate');
  6. // `Set.prototype.some` method
  7. // https://github.com/tc39/proposal-collection-methods
  8. $({ target: 'Set', proto: true, real: true, forced: true }, {
  9. some: function some(callbackfn /* , thisArg */) {
  10. var set = aSet(this);
  11. var boundFunction = bind(callbackfn, arguments.length > 1 ? arguments[1] : undefined);
  12. return iterate(set, function (value) {
  13. if (boundFunction(value, value, set)) return true;
  14. }, true) === true;
  15. }
  16. });