MCPcopy
hub / github.com/phaserjs/phaser / SpliceOne

Function SpliceOne

src/utils/array/SpliceOne.js:19–38  ·  view source on GitHub ↗
(array, index)

Source from the content-addressed store, hash-verified

17 * @return {*} The item which was spliced (removed).
18 */
19var SpliceOne = function (array, index)
20{
21 if (index >= array.length)
22 {
23 return;
24 }
25
26 var len = array.length - 1;
27
28 var item = array[index];
29
30 for (var i = index; i < len; i++)
31 {
32 array[i] = array[i + 1];
33 }
34
35 array.length = len;
36
37 return item;
38};
39
40module.exports = SpliceOne;

Callers 6

RemoveFunction · 0.85
RemoveRandomElementFunction · 0.85
RemoveAtFunction · 0.85
Tilemap.jsFile · 0.85
LightsManager.jsFile · 0.85
SpliceOne.test.jsFile · 0.85

Calls

no outgoing calls

Tested by

no test coverage detected

Used in the wild real call sites across dependent graphs

searching dependent graphs…