Skip to content

Experience-Monks/index-of-array

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

1 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

index-of-array

stable

Find the index of an array (such as a XYZ point) within a two-dimensional array. The interface is the same as Array.prototype.indexOf().

Example

var indexOfArray = require('index-of-array')

var array = [
  [ 0, 2, 3 ],
  [ 1, 4, 2 ]
]

indexOfArray(array, [0, 2, 3]) 
//=> 0

indexOfArray(array, [0, 0])
//=> -1

indexOfArray(array, [0, 2, 3], 1)
//=> -1

Install

npm install index-of-array --save

Usage

NPM

idx = indexOfArray(array, search, [fromIndex])

Finds the index of the search array inside the two-dimensional array. Optionally searches starting from the fromIndex value (can be negative to indicate "from end").

See Array.prototype.indexOf() for further details.

See Also

License

MIT, see LICENSE.md for details.

About

index of an array element within a 2D array

Resources

License

Code of conduct

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published