es6.set.js 481 B

123456789101112131415
  1. 'use strict';
  2. var strong = require('./_collection-strong');
  3. var validate = require('./_validate-collection');
  4. var SET = 'Set';
  5. // 23.2 Set Objects
  6. module.exports = require('./_collection')(SET, function (get) {
  7. return function Set() { return get(this, arguments.length > 0 ? arguments[0] : undefined); };
  8. }, {
  9. // 23.2.3.1 Set.prototype.add(value)
  10. add: function add(value) {
  11. return strong.def(validate(this, SET), value = value === 0 ? 0 : value, value);
  12. }
  13. }, strong);