removeAll.js 329 Bytes Raw Blame History Permalink 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 define(['./indexOf'], function(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); } } return removeAll; });