Nautical Poseidon Mythology

    flat-arguments

    1.0.2 • Public • Published

    flat-arguments

    Flatten a function's argument. Like, really flatten.

    Install

    npm install flat-arguments --save
    

    Usage

    Normal arguments

    var flatten = require('flat-arguments');
     
    function letsDoThis () {
      var args = flatten(arguments);
      
      // args = ['arg1', 'arg2']
    }
     
    letsDoThis('arg1', 'arg2')

    Nested arrays as arguments

    var flatten = require('flat-arguments');
     
    function letsDoThis () {
      var args = flatten(arguments);
      
      // args = ['arg1', 'arg2', 'arg3']
    }
     
    letsDoThis([['arg1', 'arg2'], 'arg3']);

    Combination of arrays and other types

    var flatten = require('flat-arguments');
     
    function letsDoThis () {
      var args = flatten(arguments);
      
      // args = ['arg1', 'arg2', 'arg3']
    }
     
    letsDoThis(['arg1', 'arg2'], 'arg3');

    Run Tests

    npm install
    npm test
    

    Install

    npm i flat-arguments

    DownloadsWeekly Downloads

    321,656

    Version

    1.0.2

    License

    MIT

    Last publish

    Collaborators

    • scottcorgan