Node-Red configuration
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

esnext.map.find.js 701B

123456789101112131415161718
  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.find` method
  7. // https://github.com/tc39/proposal-collection-methods
  8. $({ target: 'Map', proto: true, real: true, forced: true }, {
  9. find: function find(callbackfn /* , thisArg */) {
  10. var map = aMap(this);
  11. var boundFunction = bind(callbackfn, arguments.length > 1 ? arguments[1] : undefined);
  12. var result = iterate(map, function (value, key) {
  13. if (boundFunction(value, key, map)) return { value: value };
  14. }, true);
  15. return result && result.value;
  16. }
  17. });