MCPcopy Create free account
hub / github.com/developit/undom / splice

Function splice

src/util.js:9–13  ·  view source on GitHub ↗
(arr, item, add, byValueOnly)

Source from the content-addressed store, hash-verified

7}
8
9export function splice(arr, item, add, byValueOnly) {
10 let i = arr ? findWhere(arr, item, true, byValueOnly) : -1;
11 if (~i) add ? arr.splice(i, 0, add) : arr.splice(i, 1);
12 return i;
13}
14
15export function findWhere(arr, fn, returnIndex, byValueOnly) {
16 let i = arr.length;

Callers 4

insertBeforeMethod · 0.90
removeChildMethod · 0.90
removeAttributeNSMethod · 0.90
removeEventListenerMethod · 0.90

Calls 1

findWhereFunction · 0.85

Tested by

no test coverage detected

Used in the wild real call sites across dependent graphs

searching dependent graphs…