remove.js 304 B

12345678910111213
  1. var indexOf = require('./indexOf');
  2. /**
  3. * Remove a single item from the array.
  4. * (it won't remove duplicates, just a single item)
  5. */
  6. function remove(arr, item){
  7. var idx = indexOf(arr, item);
  8. if (idx !== -1) arr.splice(idx, 1);
  9. }
  10. module.exports = remove;