JSPM

  • ESM via JSPM
  • ES Module Entrypoint
  • Export Map
  • Keywords
  • License
  • Repository URL
  • TypeScript Types
  • README
  • Created
  • Published
  • Downloads 13540
  • Score
    100M100P100Q144005F
  • License MIT

Flatten a function's argument. Like, really flatten

Package Exports

  • flat-arguments

This package does not declare an exports field, so the exports above have been automatically detected and optimized by JSPM instead. If any package subpath is missing, it is recommended to post an issue to the original package (flat-arguments) to support the "exports" field. If that is not possible, create a JSPM override to customize the exports field for this package.

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