remove.js 388 B

1234567891011121314151617
  1. "use strict";
  2. var indexOf = require("./e-index-of")
  3. , forEach = Array.prototype.forEach
  4. , splice = Array.prototype.splice;
  5. // eslint-disable-next-line no-unused-vars
  6. module.exports = function (itemToRemove /*, …item*/) {
  7. forEach.call(
  8. arguments,
  9. function (item) {
  10. var index = indexOf.call(this, item);
  11. if (index !== -1) splice.call(this, index, 1);
  12. },
  13. this
  14. );
  15. };