MCPcopy
hub / github.com/fabricjs/fabric.js / pickBy

Function pickBy

src/util/misc/pick.ts:19–29  ·  view source on GitHub ↗
(
  source: T,
  predicate: <K extends keyof T>(value: T[K], key: K, collection: T) => boolean
)

Source from the content-addressed store, hash-verified

17};
18
19export const pickBy = <T extends Record<string, any>>(
20 source: T,
21 predicate: <K extends keyof T>(value: T[K], key: K, collection: T) => boolean
22) => {
23 return (Object.keys(source) as (keyof T)[]).reduce((o, key) => {
24 if (predicate(source[key], key, source)) {
25 o[key] = source[key];
26 }
27 return o;
28 }, {} as Partial<T>);
29};

Callers 3

toObjectMethod · 0.90
_extendStylesFunction · 0.90
_removeDefaultValuesMethod · 0.90

Calls

no outgoing calls

Tested by

no test coverage detected