The mutable array-like object of interest.
The amount of rotation to apply to the elements. A positive value will rotate the elements to the left. A negative value will rotate the elements to the right.
The index of the first element in the range to be
rotated, inclusive. The default value is 0
. Negative values
are taken as an offset from the end of the array.
The index of the last element in the range to be
rotated, inclusive. The default value is -1
. Negative values
are taken as an offset from the end of the array.
Linear.
A delta
, start
, or stop
which is non-integral.
import { ArrayExt } from '@lumino/algorithm';
let data = [0, 1, 2, 3, 4];
ArrayExt.rotate(data, 2); // [2, 3, 4, 0, 1]
ArrayExt.rotate(data, -2); // [0, 1, 2, 3, 4]
ArrayExt.rotate(data, 10); // [0, 1, 2, 3, 4]
ArrayExt.rotate(data, 9); // [4, 0, 1, 2, 3]
ArrayExt.rotate(data, 2, 1, 3); // [4, 2, 0, 1, 3]
Rotate the elements of an array in-place.