JSPM

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

converts arguments or any other array-like object into an array starting from specific index.

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 npm bundle size jsdelivr dependencies Status devDependencies Status npm type definitions codecov Known Vulnerabilities GitHub

Converts arguments or any other array-like object into an array starting from specific index.

Inspired by how Typescript handles ...rest arguments.

Install

npm i args-to-arr

CDN

jsDelivr

www.jsdelivr.com

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

more options...

unpkg

unpkg.com

<script src="https://unpkg.com/args-to-arr@latest/dist/args-to-arr.umd.js"></script>
for production
<script src="https://unpkg.com/args-to-arr@latest/dist/args-to-arr.umd.min.js"></script>

more options...

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