shared
utils
string
object
is
extension
js
tracking
string
dom
when
selection
position
iframe
event
scroll
console
node
string
project
fs
console
find
Type:Function
Status:stable
Since:1.0.0
Platform:jsnode
@blackbyte.sugar.shared.array
This function is a subset of the native “find”. It returns the:
- index: the position in the array
- value: the actual value at this position
Params
- ar*-Array
The array in which to search for an item
- check*-Function
The check function to test if the element is the searched one
Return
- -TFindResult|null
An object containing the index and value of the finded item, or null if nothing found
Example
import { find } from '@blackbyte/sugar/array';
find(['hello','world'], (item: any) => item === 'world')
{
index: 1,
value: 'world'
}Author
- Olivier Bosselolivier.bossel@gmail.comhttps://blackbyte.space