ab1ae10d1a9c686755646376bb420593b2640367
1 // Remove item in array (if present)
2 var removeItem = function(array
, rfun
)
4 let index
= array
.findIndex(rfun
);
6 array
.splice(index
, 1);
9 // Remove several item matching a condition
10 var removeMultiple = function(array
, rfun
)
12 // Reverse loop because of the splice below
13 for (let i
=array
.length
-1; i
>=0; i
--)
20 // Double array intialization
21 var doubleArray = function(size1
, size2
, initElem
)
23 return _
.map(_
.range(size1
), () => {
24 return _
.map(_
.range(size2
), () => {
25 return initElem
; //can be undefined
30 var copyDoubleArray = function(arr
)
32 return _
.map(_
.range(arr
.length
), (el1
,i
) => {
33 return _
.map(_
.range(arr
[0].length
), (el2
,j
) => {