3.1.2 • Published 6 years ago

calculate-from-index-x v3.1.2

Weekly downloads
496
License
MIT
Repository
github
Last release
6 years ago

calculate-from-index-x

Calculates a fromIndex of a given value for an array.

module.exports(array, fromIndex)number

This method calculates a fromIndex of a given value for an array.

Kind: Exported function
Returns: number - The calculated fromIndex. Default is 0.
Throws:

  • TypeError If array is null or undefined.
ParamTypeDescription
arrayarray* The array on which to calculate the starting index.
fromIndexnumber* The position in this array at which to begin. A negative value gives the index of array.length + fromIndex by asc.

Example

import calcFromIndex from 'calculate-from-index-x';

console.log(calcFromIndex([1, 2, 3], 1)); // 1
console.log(calcFromIndex([1, 2, 3], Infinity)); // Infinity
console.log(calcFromIndex([1, 2, 3], -Infinity)); // 0
console.log(calcFromIndex([1, 2, 3], -1)); // 2
3.1.2

6 years ago

3.1.1

6 years ago

3.1.0

6 years ago

3.0.19

6 years ago

3.0.18

6 years ago

3.0.17

6 years ago

3.0.16

6 years ago

3.0.15

6 years ago

3.0.14

6 years ago

3.0.13

6 years ago

3.0.12

6 years ago

3.0.11

6 years ago

3.0.10

6 years ago

3.0.9

6 years ago

3.0.8

6 years ago

3.0.7

6 years ago

3.0.6

6 years ago

3.0.5

6 years ago

3.0.4

6 years ago

3.0.3

6 years ago

3.0.2

6 years ago

3.0.1

6 years ago

2.2.0

8 years ago

2.1.0

8 years ago

2.0.1

8 years ago

2.0.0

8 years ago

1.0.2

8 years ago

1.0.1

8 years ago

1.0.0

8 years ago