Not a Propaganda Machine

    arr-rotate

    1.0.0 • Public • Published

    arr-rotate Build Status

    Rotate all items in an array

    Install

    $ npm install arr-rotate
    

    Usage

    const arrRotate = require('arr-rotate');
     
    arrRotate(['foo', 'bar', 'unicorn'], 2);
    //=> ['bar', 'unicorn', 'foo']
     
    arrRotate(['foo', 'bar', 'unicorn'], 1);
    //=> ['unicorn', 'foo', 'bar']
     
    arrRotate(['foo', 'bar', 'unicorn'], -1);
    //=> ['bar', 'unicorn', 'foo']

    API

    arrRotate(input, num)

    input

    Type: Array

    Array to rotate.

    num

    Type: number
    Default: 0

    Number of steps to rotate.

    License

    MIT © Kevin Martensson

    Install

    npm i arr-rotate

    DownloadsWeekly Downloads

    104,591

    Version

    1.0.0

    License

    MIT

    Unpacked Size

    2.58 kB

    Total Files

    4

    Last publish

    Collaborators

    • kevva