esnext.set.every.js 660 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.every` method
  7. // https://github.com/tc39/proposal-collection-methods
  8. $({ target: 'Set', proto: true, real: true, forced: true }, {
  9. every: function every(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 false;
  14. }, true) !== false;
  15. }
  16. });