findNthIndex()

Get the nth index of the target in subject.

This function is valid in v2.8.0 to v2.24.3. This function has been downloaded 61 times.

Parameters

{Array|string} subject
Array or string to search for target in.
{Function|RegExp} target
If subject is an array this must either be a function or a regular expression which will be tested against each element in subject. If subject is a string this must be a regular expression which will be tested against it to find all of the matches.
{number} n
The number of the occurrence that will be searched for and returned. 0 represents the first occurrence whereas -1 represents the last.

Returns

{number|undefined}
If the nth occurrence of target can be found within subject the index will be returned otherwise undefined will be returned.

Required Function

This function directly requires the following function which is included automatically:

  • findNth()
    Gets the nth value matching target in subject.

Requiring Function

This function is directly required by the following function:

  • findNth()
    Gets the nth value matching target in subject.