MCPcopy
hub / github.com/date-fns/date-fns / findKey

Function findKey

pkgs/core/src/locale/_lib/buildMatchFn/index.ts:111–124  ·  view source on GitHub ↗
(
  object: Obj,
  predicate: (value: Value) => boolean,
)

Source from the content-addressed store, hash-verified

109}
110
111function 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
126function findIndex<Item>(
127 array: Item[],

Callers 1

buildMatchFnFunction · 0.85

Calls

no outgoing calls

Tested by

no test coverage detected