An open API service indexing awesome lists of open source software.

https://github.com/writetome51/array-get-indexes-basic

array-handling functions that return indexes of items in the array
https://github.com/writetome51/array-get-indexes-basic

array-manipulations get-index indexes javascript

Last synced: 6 months ago
JSON representation

array-handling functions that return indexes of items in the array

Awesome Lists containing this project

README

          

# getFirstIndexOf(value, array): number

Returns index of first instance of `value` found in `array`.
`value` can be a primitive or array . Returns -1 if `value` not found.

# getIndexOfPrimitive(
      primitive,
      array,
      startingPosition? = 0
): number

Behaves like `Array.indexOf()`, except it does strict type-checking on `primitive`.
Change `startingPosition` to get something other than the first index.
startingPosition can also be negative to search from the end.
Returns -1 if `primitive` not found.

# getFirstIndexOfArray(
      arrayToSearchFor,
      arrayToSearchInside
): number

If `arrayToSearchFor` is found in `arrayToSearchInside`, this returns
the index of the first found instance. Returns -1 if not found.

# getIndexesOfPrimitive(primitive, array): number[]

If `primitive` isn't found, returns empty array.

# getIndexesOfArray(
      arrayToSearchFor,
      arrayToSearchInside
): number[]

if `arrayToSearchFor` isn't found, returns empty array.