A new array with the specified values.
An exception if the slice step
is 0
.
Linear.
A start
, stop
, or step
which is non-integral.
import { ArrayExt } from '@lumino/algorithm';
let data = [0, 3, 4, 7, 7, 9];
ArrayExt.slice(data); // [0, 3, 4, 7, 7, 9]
ArrayExt.slice(data, { start: 2 }); // [4, 7, 7, 9]
ArrayExt.slice(data, { start: 0, stop: 4 }); // [0, 3, 4, 7]
ArrayExt.slice(data, { step: 2 }); // [0, 4, 7]
ArrayExt.slice(data, { step: -1 }); // [9, 7, 7, 4, 3, 0]
Generated using TypeDoc
Create a slice of an array subject to an optional step.