MCPcopy
hub / github.com/Kong/insomnia / remove

Function remove

packages/insomnia/bin/yarn-standalone.js:15480–15499  ·  view source on GitHub ↗

* Removes all elements from `array` that `predicate` returns truthy for * and returns an array of the removed elements. The predicate is invoked * with three arguments: (value, index, array). * * **Note:** Unlike `_.filter`, this method mutates `array`. Use `_.pull` * to pul

(array, predicate)

Source from the content-addressed store, hash-verified

15478 * // => [2, 4]
15479 */
15480 function remove(array, predicate) {
15481 var result = [];
15482 if (!(array && array.length)) {
15483 return result;
15484 }
15485 var index = -1,
15486 indexes = [],
15487 length = array.length;
15488
15489 predicate = getIteratee(predicate, 3);
15490 while (++index < length) {
15491 var value = array[index];
15492 if (predicate(value, index, array)) {
15493 result.push(value);
15494 indexes.push(index);
15495 }
15496 }
15497 basePullAt(array, indexes);
15498 return result;
15499 }
15500
15501 /**
15502 * Reverses `array` so that the first element becomes the last, the second

Callers 2

rmFunction · 0.70
deleteStaleRequestsFunction · 0.50

Calls 9

getIterateeFunction · 0.85
basePullAtFunction · 0.85
_load_asyncToGeneratorFunction · 0.85
_load_removeFunction · 0.85
unloadFunction · 0.85
pushMethod · 0.45
langMethod · 0.45
filterMethod · 0.45
errorMethod · 0.45

Tested by

no test coverage detected