import { type ArrayOrValue } from './array/array'; import { type MapFunction } from './value/map'; import { type Maybe } from './value/maybe.type'; /** * A key made up of either a string or number value. */ export type PrimativeKey = string | number; /** * A key of a type. */ export type FieldOfType = keyof T; /** * Reads a key from the input object. */ export type ReadKeyFunction = MapFunction>; /** * Reads a key value from the input object that is required to exist. */ export type ReadRequiredKeyFunction = MapFunction; /** * Reads all keys from the input object. Can return null/undefined. */ export type ReadAllKeysFunction = MapFunction>>; /** * Reads one or more keys from the input object. */ export type ReadOneOrMoreKeysFunction = MapFunction>; /** * Reads multiple keys from the input object. */ export type ReadMultipleKeysFunction = MapFunction; /** * Reads multiple keys from the input object or objects */ export type ReadKeysFunction = MapFunction, K[]>; /** * Creates a {@link ReadKeysFunction} from a key-reading function. Handles both single and array inputs, * filtering out null/undefined keys. * * @param readKey - Function that extracts one or more keys from a value. * @returns A function that reads keys from a single value or array of values. * * @example * ```ts * const fn = readKeysFunction((x) => x); * fn(['a', 'b', 'c']); // ['a', 'b', 'c'] * ``` */ export declare function readKeysFunction(readKey: ReadKeyFunction | ReadMultipleKeysFunction): ReadKeysFunction; /** * Convenience function that reads all keys from an array of values using the provided key-reading function. * * @param readKey - Function that extracts one or more keys from a value. * @param values - Values to read keys from. * @returns An array of all extracted keys. */ export declare function readKeysFrom(readKey: ReadKeyFunction | ReadMultipleKeysFunction, values: T[]): K[]; /** * Reads all defined keys from the input objects to a Set. */ export type ReadKeysSetFunction = MapFunction>; /** * Creates a {@link ReadKeysSetFunction} from a key-reading function. Like {@link readKeysFunction} but returns a Set, deduplicating keys. * * @param readKey - Function that extracts one or more keys from a value. * @returns A function that reads keys from values into a Set. * * @example * ```ts * const fn = readKeysSetFunction((x) => x); * fn(['a', 'b', 'a']); // Set { 'a', 'b' } * ``` */ export declare function readKeysSetFunction(readKey: ReadKeyFunction | ReadMultipleKeysFunction): ReadKeysSetFunction; /** * Convenience function that reads all keys from an array of values into a Set using the provided key-reading function. * * @param readKey - Function that extracts one or more keys from a value. * @param values - Values to read keys from. * @returns A Set of all extracted keys. */ export declare function readKeysSetFrom(readKey: ReadKeyFunction | ReadMultipleKeysFunction, values: T[]): Set;