diff options
-rw-r--r-- | public/common/util.js | 7 |
1 files changed, 7 insertions, 0 deletions
diff --git a/public/common/util.js b/public/common/util.js index 0edaf2a..0f6fc44 100644 --- a/public/common/util.js +++ b/public/common/util.js @@ -99,6 +99,13 @@ function array_remove(array, index) { array.length = n - 1 } +function array_remove_item(array, item) { + let n = array.length + for (let i = 0; i < n; ++i) + if (array[i] === item) + return array_remove(array, i) +} + function array_insert(array, index, item) { for (let i = array.length; i > index; --i) array[i] = array[i - 1] |