each-arg
Iterates through arguments or any other array-like object starting from a specific index.
Install
npm i each-arg
CDN
jsDelivr
for production...
unpkg
for production...
Reference
syntax
eachArgarr, start, callbackvalue, index, ...extra: any, ...extra: void;
Iterates over the array
, string
or array-like
arr
starting from the start
index. The callback
function will be called for every value
in the array, with the value
itself, the index
of the current item and any extra
argument passed to eachArg
function.
If a negative start
index is provided the iteration will start from X
number of items counting from the last item in the input array-like.
If the callback
returns a truthy value the iteration will stop.
Any extra
argument passed to eachArg
function will be passed down to the callback
function.
The callback
function inherits the this
value form the eachArg
function call. If you need a specific value inside the callback
, call eachArg
using it's call
method.
eachArg.callthisArg, arr, start, callback, ..extra;
example
; ;
2 >> 1013 >> 1024 >> 103
Usage
Node.js
const eachArg = ;;
Browser
After adding the script
tag, eachArg
function will be available globally through eachArg
or window.eachArg
.
;