index-of-sequence
Find the first index at which a given sequence of elements can be found in the array
; ; //=> 2
Installation
npm
npm install index-of-sequence
bower
bower install index-of-sequence
API
indexOfSequence(array, searchArray [, fromIndex])
array: Array
searchArray: Array
(the sequence of values to search for)
fromIndex: Number
(index in the string where to begin searching)
Return: Number
(the first index of the sequence of values)
It returns 0
or a positive integer (1
, 2
, ...) when it finds at least one sequence of values in the array.
; //=> 0; //=> 7
Otherwise, it returns -1
.
; //=> -1; //=> -1; //=> -1
License
Copyright (c) 2016 Shinnosuke Watanabe
Licensed under the MIT License.