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.weak-set.delete-all.js 659B

123456789101112131415161718
  1. 'use strict';
  2. var $ = require('../internals/export');
  3. var aWeakSet = require('../internals/a-weak-set');
  4. var remove = require('../internals/weak-set-helpers').remove;
  5. // `WeakSet.prototype.deleteAll` method
  6. // https://github.com/tc39/proposal-collection-methods
  7. $({ target: 'WeakSet', proto: true, real: true, forced: true }, {
  8. deleteAll: function deleteAll(/* ...elements */) {
  9. var collection = aWeakSet(this);
  10. var allDeleted = true;
  11. var wasDeleted;
  12. for (var k = 0, len = arguments.length; k < len; k++) {
  13. wasDeleted = remove(collection, arguments[k]);
  14. allDeleted = allDeleted && wasDeleted;
  15. } return !!allDeleted;
  16. }
  17. });