calculate-from-index-x
Calculates a fromIndex of a given value for an array.
Version: 1.0.0
Author: Xotic750 Xotic750@gmail.com
License: MIT
Copyright: Xotic750
module.exports
⇒ number
⏏
This method calculates a fromIndex of a given value for an array.
Kind: Exported member
Returns: number
- The calculated fromIndex. Default id 0.
Throws:
TypeError
If array is null or undefined.
Param | Type | Description |
---|
array | array | The array on which to calculate the starting index. |
fromIndex | number | The position in this array at which to begin. A negative value gives the index of array.length + fromIndex by asc. |
Example
var calcFromIndex = require('calculate-from-index-x');
calcFromIndex([1, 2, 3], 1);
calcFromIndex([1, 2, 3], Infinity);
calcFromIndex([1, 2, 3], -Infinity);
calcFromIndex([1, 2, 3], -1);