Nucleic Photon Magnetizer

    @extra-array/rotate-update.min
    TypeScript icon, indicating that this package has built-in type declarations

    2.10.19 • Public • Published

    Rotates values in array. 📦 😺 🏃 📼 🌔 📜 📰 📘

    Alternatives: rotate, rotate$.
    Similar: repeat, cycle, rotate, reverse.

    This is part of package extra-array.

    This is browserified, minified version of @extra-array/rotate-update.
    It is exported as global variable array_rotate$.
    CDN: unpkg, jsDelivr.


    array.rotate$(x, [n]);
    // x: an array (updated)
    // n: rotate amount (+ve: left, -ve: right)
    // → x
    const array = require("extra-array");
    
    var x = [1, 2, 3, 4];
    array.rotate$(x, 1);
    // [ 2, 3, 4, 1 ]
    
    x;
    // [ 2, 3, 4, 1 ]
    
    var x = [1, 2, 3, 4];
    array.rotate$(x, 2);
    // [ 3, 4, 1, 2 ]
    
    var x = [1, 2, 3, 4];
    array.rotate$(x, -1);
    // [ 4, 1, 2, 3 ]


    References

    Install

    npm i @extra-array/rotate-update.min

    DownloadsWeekly Downloads

    2

    Version

    2.10.19

    License

    MIT

    Unpacked Size

    6.16 kB

    Total Files

    8

    Last publish

    Collaborators

    • wolfram77