Wondering what’s next for npm?Check out our public roadmap! »

    @bemoje/arr-swap

    1.0.2 • Public • Published

    @bemoje/arr-swap

    Swap array elements in place. Runtime: O(1)

    Version

    NPM version

    Travis CI

    dependencies

    Dependencies

    dependencies

    Stats

    NPM downloads Forks

    Donate

    Buy Me A Beer donate button PayPal donate button

    Installation

    npm install @bemoje/arr-swap
    npm install --save @bemoje/arr-swap
    npm install --save-dev @bemoje/arr-swap

    Usage

    import arrSwap from '@bemoje/arr-swap'
     
    const arr = [10, 20]
     
    arrSwap(arr, 0, 1)
     
    console.log(arr)
    //=> [20, 10]
     

    Tests

    Uses Jest to test module functionality. Run tests to get coverage details.

    npm run test

    API

    arrSwap

    Swap array elements in place. Runtime: O(1)

    Parameters
    • arr array to be modified

    • from number index of the first element

    • to number index of the 2nd element

    Returns

    void

    Install

    npm i @bemoje/arr-swap

    DownloadsWeekly Downloads

    13

    Version

    1.0.2

    License

    MIT

    Unpacked Size

    6.86 kB

    Total Files

    5

    Last publish

    Collaborators

    • avatar