collection-add-all.js 387 B

12345678910111213
  1. 'use strict';
  2. var anObject = require('../internals/an-object');
  3. var aFunction = require('../internals/a-function');
  4. // https://github.com/tc39/collection-methods
  5. module.exports = function (/* ...elements */) {
  6. var set = anObject(this);
  7. var adder = aFunction(set.add);
  8. for (var k = 0, len = arguments.length; k < len; k++) {
  9. adder.call(set, arguments[k]);
  10. }
  11. return set;
  12. };