Function
findKey
(
object: Obj,
predicate: (value: Value) => boolean,
)
Source from the content-addressed store, hash-verified
| 109 | } |
| 110 | |
| 111 | function findKey<Value, Obj extends { [key in string | number]: Value }>( |
| 112 | object: Obj, |
| 113 | predicate: (value: Value) => boolean, |
| 114 | ): keyof Obj | undefined { |
| 115 | for (const key in object) { |
| 116 | if ( |
| 117 | Object.prototype.hasOwnProperty.call(object, key) && |
| 118 | predicate(object[key]) |
| 119 | ) { |
| 120 | return key; |
| 121 | } |
| 122 | } |
| 123 | return undefined; |
| 124 | } |
| 125 | |
| 126 | function findIndex<Item>( |
| 127 | array: Item[], |
Tested by
no test coverage detected