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.merge.js 745B

12345678910111213141516171819202122
  1. 'use strict';
  2. var $ = require('../internals/export');
  3. var aMap = require('../internals/a-map');
  4. var iterate = require('../internals/iterate');
  5. var set = require('../internals/map-helpers').set;
  6. // `Map.prototype.merge` method
  7. // https://github.com/tc39/proposal-collection-methods
  8. $({ target: 'Map', proto: true, real: true, arity: 1, forced: true }, {
  9. // eslint-disable-next-line no-unused-vars -- required for `.length`
  10. merge: function merge(iterable /* ...iterables */) {
  11. var map = aMap(this);
  12. var argumentsLength = arguments.length;
  13. var i = 0;
  14. while (i < argumentsLength) {
  15. iterate(arguments[i++], function (key, value) {
  16. set(map, key, value);
  17. }, { AS_ENTRIES: true });
  18. }
  19. return map;
  20. }
  21. });