JSPM

  • Created
  • Published
  • Downloads 135
  • Score
    100M100P100Q77064F
  • License MIT

Arguments to array, the easy way

Package Exports

  • args-to-arr

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 (args-to-arr) to support the "exports" field. If that is not possible, create a JSPM override to customize the exports field for this package.

Readme

args-to-arr

CircleCI Greenkeeper badge npm install size jsdelivr dependencies Status devDependencies Status npm type definitions codecov Known Vulnerabilities GitHub

Arguments to array, the easy way

Install

npm i args-to-arr

CDN

jsDelivr

www.jsdelivr.com

<script src="https://cdn.jsdelivr.net/npm/args-to-arr/dist/args-to-arr.umd.js"></script>
for production
<script src="https://cdn.jsdelivr.net/npm/args-to-arr/dist/args-to-arr.umd.min.js"></script>

more options on jsDelivr website...

unpkg

unpkg.com

<script src="https://unpkg.com/args-to-arr/dist/args-to-arr.umd.js"></script>

Usage

syntax
toArray<T>(arr: ArrayLike<T>, start: number = 0): T[];

Note that args-to-arr supports any array-like object

example
import toArray from "args-to-arr";

function anything(firstArg) {

  // convert arguments to array
  // starting from argument 1
  // it won't include firstArg
  const args = toArray(arguments, 1);

  // do something with the array

}

License

MIT © Manuel Fernández