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

123456789101112131415161718
  1. 'use strict';
  2. var $ = require('../internals/export');
  3. var aSet = require('../internals/a-set');
  4. var remove = require('../internals/set-helpers').remove;
  5. // `Set.prototype.deleteAll` method
  6. // https://github.com/tc39/proposal-collection-methods
  7. $({ target: 'Set', proto: true, real: true, forced: true }, {
  8. deleteAll: function deleteAll(/* ...elements */) {
  9. var collection = aSet(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. });