aboutsummaryrefslogtreecommitdiff
path: root/node_modules/core-js/internals/collection-delete-all.js
diff options
context:
space:
mode:
Diffstat (limited to 'node_modules/core-js/internals/collection-delete-all.js')
-rw-r--r--node_modules/core-js/internals/collection-delete-all.js16
1 files changed, 16 insertions, 0 deletions
diff --git a/node_modules/core-js/internals/collection-delete-all.js b/node_modules/core-js/internals/collection-delete-all.js
new file mode 100644
index 0000000..37b4d48
--- /dev/null
+++ b/node_modules/core-js/internals/collection-delete-all.js
@@ -0,0 +1,16 @@
+'use strict';
+var anObject = require('../internals/an-object');
+var aFunction = require('../internals/a-function');
+
+// https://github.com/tc39/collection-methods
+module.exports = function (/* ...elements */) {
+ var collection = anObject(this);
+ var remover = aFunction(collection['delete']);
+ var allDeleted = true;
+ var wasDeleted;
+ for (var k = 0, len = arguments.length; k < len; k++) {
+ wasDeleted = remover.call(collection, arguments[k]);
+ allDeleted = allDeleted && wasDeleted;
+ }
+ return !!allDeleted;
+};