es6.weak-set.js 473 B

1234567891011121314
  1. 'use strict';
  2. var weak = require('./_collection-weak');
  3. var validate = require('./_validate-collection');
  4. var WEAK_SET = 'WeakSet';
  5. // 23.4 WeakSet Objects
  6. require('./_collection')(WEAK_SET, function (get) {
  7. return function WeakSet() { return get(this, arguments.length > 0 ? arguments[0] : undefined); };
  8. }, {
  9. // 23.4.3.1 WeakSet.prototype.add(value)
  10. add: function add(value) {
  11. return weak.def(validate(this, WEAK_SET), value, true);
  12. }
  13. }, weak, false, true);