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
- Host: GitHub
- URL: https://github.com/writetome51/array-get-indexes-basic
- Owner: writetome51
- License: mit
- Created: 2018-09-26T18:45:21.000Z (over 7 years ago)
- Default Branch: master
- Last Pushed: 2019-02-24T01:23:19.000Z (almost 7 years ago)
- Last Synced: 2025-06-21T04:09:59.610Z (7 months ago)
- Topics: array-manipulations, get-index, indexes, javascript
- Language: TypeScript
- Size: 32.2 KB
- Stars: 0
- Watchers: 1
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
- License: LICENSE
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.