UNPKG

@naverpay/hidash

Version:

improved lodash

20 lines (17 loc) 1.28 kB
import { ValueKeyIterateeTypeGuard, ValueKeyIteratee } from './internal/baseIteratee.type.js'; import { Dictionary, NumericDictionary } from './internal/types.js'; /** * @description * Creates an object composed of the properties that pass a given predicate. * If no predicate is provided, it returns all properties in the object. * * @param {object} [object] The object to iterate over * @param {ValueKeyIteratee<T, boolean>} [predicate] The function invoked per iteration * @returns {object} An object composed of the properties that pass the predicate */ declare function pickBy<T, S extends T>(object: Dictionary<T> | null | undefined, predicate: ValueKeyIterateeTypeGuard<T, S>): Dictionary<S>; declare function pickBy<T, S extends T>(object: NumericDictionary<T> | null | undefined, predicate: ValueKeyIterateeTypeGuard<T, S>): NumericDictionary<S>; declare function pickBy<T>(object: Dictionary<T> | null | undefined, predicate?: ValueKeyIteratee<T>): Dictionary<T>; declare function pickBy<T>(object: NumericDictionary<T> | null | undefined, predicate?: ValueKeyIteratee<T>): NumericDictionary<T>; declare function pickBy<T extends object>(object: T | null | undefined, predicate?: ValueKeyIteratee<T[keyof T]>): Partial<T>; export { pickBy as default, pickBy };