The array of interest.
The index at which to insert the value. Negative values are taken as an offset from the end of the array.
The value to set at the specified index.
Linear.
An index
which is non-integral.
import { ArrayExt } from '@lumino/algorithm';
let data = [0, 1, 2];
ArrayExt.insert(data, 0, -1); // [-1, 0, 1, 2]
ArrayExt.insert(data, 2, 12); // [-1, 0, 12, 1, 2]
ArrayExt.insert(data, -1, 7); // [-1, 0, 12, 1, 7, 2]
ArrayExt.insert(data, 6, 19); // [-1, 0, 12, 1, 7, 2, 19]
Insert a value into an array at a specific index.