args-to-arr

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) {
const args = toArray(arguments, 1);
}
License
MIT © Manuel Fernández