Skip to content

shift

Shifts array items by `n` steps. If `n` is greater than 0, items will shift `n` steps to the right. If `n` is less than 0, items will shift `n` steps to the left.

Usage

shift([1, 2, 3], 1); // [3, 1, 2]
shift([1, 2, 3], -1); // [2, 3, 1]

Installation

Terminal window
npx atmx add helper shift