2.1.5 • Published 3 years ago

array-test-tomasbarcojo v2.1.5

Weekly downloads
-
License
ISC
Repository
-
Last release
3 years ago

Rotation of an array

A fuction to rotate 'k' times left or right an array.

Installation

Use the package manager npm to install.

npm i array-test-tomasbarcojo

Usage

Positive number: rotates to right Negative number: rotates to left

import { rotateArray } from 'array-test-tomasbarcojo'

let test = [1, 2, 3, 4, 5]

rotateArray(test, 2) # returns [ 4, 5, 1, 2, 3 ]
rotateArray(test, -2) # returns [ 3, 4, 5, 1, 2 ]
2.1.5

3 years ago

2.1.4

3 years ago

2.1.3

3 years ago

2.1.2

3 years ago

2.1.1

3 years ago

2.1.0

3 years ago

2.0.0

3 years ago

1.0.0

3 years ago