collection-add-all.js 444 B

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