esnext.map.some.js 657 B

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