diff options
-rw-r--r-- | rules.js | 22 |
1 files changed, 12 insertions, 10 deletions
@@ -7782,12 +7782,12 @@ function random(range) { } // remove item at index (faster than splice) + function array_remove(array, index) { let n = array.length for (let i = index + 1; i < n; ++i) array[i - 1] = array[i] array.length = n - 1 - return array } // insert item at index (faster than splice) @@ -7795,7 +7795,6 @@ function array_insert(array, index, item) { for (let i = array.length; i > index; --i) array[i] = array[i - 1] array[index] = item - return array } function set_clear(set) { @@ -7829,9 +7828,9 @@ function set_add(set, item) { else if (item > x) a = m + 1 else - return set + return } - return array_insert(set, a, item) + array_insert(set, a, item) } function set_delete(set, item) { @@ -7844,10 +7843,11 @@ function set_delete(set, item) { b = m - 1 else if (item > x) a = m + 1 - else - return array_remove(set, m) + else { + array_remove(set, m) + return + } } - return set } function set_toggle(set, item) { @@ -7860,10 +7860,12 @@ function set_toggle(set, item) { b = m - 1 else if (item > x) a = m + 1 - else - return array_remove(set, m) + else { + array_remove(set, m) + return + } } - return array_insert(set, a, item) + array_insert(set, a, item) } // Fast deep copy for objects without cycles |