UNPKG

rc-js-util

Version:

A collection of TS and C++ utilities to help writing performant and correct applications, achieved through strict typing and (removable) invariant checking.

94 lines (44 loc) 1.26 kB
<!-- Do not edit this file. It is automatically generated by API Documenter. --> [Home](./index.md) &gt; [rc-js-util](./rc-js-util.md) &gt; [arrayMapRange](./rc-js-util.arraymaprange.md) ## arrayMapRange() function Like [arrayMap()](./rc-js-util.arraymap.md) with integer range as input. **Signature:** ```typescript export declare function arrayMapRange<TMapped>(from: number, to: number, callback: (value: number, index: number) => TMapped): TMapped[]; ``` ## Parameters <table><thead><tr><th> Parameter </th><th> Type </th><th> Description </th></tr></thead> <tbody><tr><td> from </td><td> number </td><td> The value to start from (inclusive). </td></tr> <tr><td> to </td><td> number </td><td> The value to finish with (inclusive). </td></tr> <tr><td> callback </td><td> (value: number, index: number) =&gt; TMapped </td><td> Called for each value in the range. </td></tr> </tbody></table> **Returns:** TMapped\[\] An array of results from the callback. ## Remarks Where `from` and `to` are equal a length 1 array is returned, NaN input is not supported. See [arrayMapRange()](./rc-js-util.arraymaprange.md)<!-- -->.