flat-arguments

Flatten a function's argument. Like, really flatten

Downloads in past

Stats

StarsIssuesVersionUpdatedCreatedSize
flat-arguments
001.0.28 years ago9 years agoMinified + gzip package size for flat-arguments in KB

Readme

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