node-lib

@wtasnorg/node-lib


@wtasnorg/node-lib / findValues

Function: findValues()

findValues(obj, targets, compare?, whenFound?): void

Defined in: src/find-value.ts:96

Search obj for multiple target values at once.

Parameters

obj

Record<string, unknown>

The object to search.

targets

unknown

A single value or array of values to look for.

compare?

FindValueCompare

Comparator (defaults to strict equality).

whenFound?

FindValueCallback

Callback for each match (defaults to console.log).

Returns

void

Example

const results: FindValueMatch[] = [];
findValues({ a: 1, b: 2, c: 3 }, [1, 3], undefined, (m) => results.push(m));
// results → [{ loc: "a", val: 1 }, { loc: "c", val: 3 }]