result and its index, null if not found
Like flatMap, this function walks through the nested(multi-dimension) array. This function keep the original dimension. e.g.: deepMap([1, [2, 3]], x => x + 1) => [2, [3, 4]]
Check if an array contains any elements. null/undefined are considered empty.
Pick a value from a deep array by its indices. e.g.: pick(arr, 1, 2, 3) = arr[1][2][3] if an array is supplied as the last parameter, it will be filled with arrays in each level e.g.: [rootArray, subArray, ..., parentArray]
target value indices in a deep array. e.g. the indice of value arr[i1][i2][i3]
is [i1, i2, i3]
the last one can be an empty array to hold parents in each level
Swap value of array's two positions
arr
Experiment feature...
Generated using TypeDoc
Perform binary search on a sorted array. Element will be fed to predict function, if true, the target is found and returned, otherwise onward function is called and the returned value determins the next move: true - left-ward continuance false - right-ward continuance
null is returned if none is suitable