removeAll.js 331 Bytes Raw Blame History Permalink 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 var indexOf = require('./indexOf'); /** * Remove all instances of an item from array. */ function removeAll(arr, item){ var idx = indexOf(arr, item); while (idx !== -1) { arr.splice(idx, 1); idx = indexOf(arr, item, idx); } } module.exports = removeAll;