MCPcopy Index your code
hub / github.com/yargs/yargs / objFilter

Function objFilter

lib/utils/obj-filter.ts:3–14  ·  view source on GitHub ↗
(
  original = {} as T,
  filter: (k: keyof T, v: T[keyof T]) => boolean = () => true
)

Source from the content-addressed store, hash-verified

1import {objectKeys} from '../typings/common-types.js';
2
3export function objFilter<T extends object>(
4 original = {} as T,
5 filter: (k: keyof T, v: T[keyof T]) => boolean = () => true
6) {
7 const obj = {} as T;
8 objectKeys(original).forEach(key => {
9 if (filter(key, original[key])) {
10 obj[key] = original[key];
11 }
12 });
13 return obj;
14}

Callers 5

positionalMethod · 0.85
[kReset]Method · 0.85
validationFunction · 0.85
usageFunction · 0.85
obj-filter.mjsFile · 0.85

Calls 1

objectKeysFunction · 0.85

Tested by

no test coverage detected

Used in the wild real call sites across dependent graphs

searching dependent graphs…