2.1.5 • Published 4 years ago

array-test-tomasbarcojo v2.1.5

Weekly downloads
-
License
ISC
Repository
-
Last release
4 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

4 years ago

2.1.4

4 years ago

2.1.3

4 years ago

2.1.2

4 years ago

2.1.1

4 years ago

2.1.0

4 years ago

2.0.0

4 years ago

1.0.0

4 years ago