Node-Red configuration
您最多选择25个主题 主题必须以字母或数字开头,可以包含连字符 (-),并且长度不得超过35个字符

esnext.set.map.js 779B

1234567891011121314151617181920212223
  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 SetHelpers = require('../internals/set-helpers');
  6. var iterate = require('../internals/set-iterate');
  7. var Set = SetHelpers.Set;
  8. var add = SetHelpers.add;
  9. // `Set.prototype.map` method
  10. // https://github.com/tc39/proposal-collection-methods
  11. $({ target: 'Set', proto: true, real: true, forced: true }, {
  12. map: function map(callbackfn /* , thisArg */) {
  13. var set = aSet(this);
  14. var boundFunction = bind(callbackfn, arguments.length > 1 ? arguments[1] : undefined);
  15. var newSet = new Set();
  16. iterate(set, function (value) {
  17. add(newSet, boundFunction(value, value, set));
  18. });
  19. return newSet;
  20. }
  21. });