MCPcopy Create free account
hub / github.com/bugy/script-server / removeElementIf

Function removeElementIf

web-src/src/common/utils/common.js:207–214  ·  view source on GitHub ↗
(array, predicate)

Source from the content-addressed store, hash-verified

205
206// removes elements from the array, for which predicate is true
207export function removeElementIf(array, predicate) {
208 for (let i = array.length; i >= 0; i--) {
209 const arrayElement = array[i];
210 if (predicate(arrayElement)) {
211 array.splice(i, 1);
212 }
213 }
214}
215
216export function removeElements(array, elements) {
217 for (var i = 0; i < elements.length; i++) {

Callers

nothing calls this directly

Calls

no outgoing calls

Tested by

no test coverage detected