- Preparing search index...
- The search index is not available
@hat-open/util
- _find<T>(fn: ((val: T, index?: number, arr?: T) => boolean), arr: T[]): T | undefined
-
Parameters
-
fn: ((val: T, index?: number, arr?: T) => boolean)
-
- (val: T, index?: number, arr?: T): boolean
-
Parameters
-
val: T
-
Optional
index: number
-
Optional
arr: T
Returns boolean
-
arr: T[]
Returns T | undefined
- _find<T>(fn: ((val: T, key?: string, obj?: Record<string, T>) => boolean), obj: Record<string, T>): T | undefined
-
Parameters
-
fn: ((val: T, key?: string, obj?: Record<string, T>) => boolean)
-
- (val: T, key?: string, obj?: Record<string, T>): boolean
-
Parameters
-
val: T
-
Optional
key: string
-
Optional
obj: Record<string, T>
Returns boolean
-
obj: Record<string, T>
Returns T | undefined
Find element in array or object for which provided function returns
true
Until element is found, provided function is called for each element with arguments: current element, current index/key and initial container.
If searched element is not found,
undefined
is returned.