/** A type alias representing an object with string keys and values of any type. */ export type ocxKey = { [key: string]: any; }; /** A generic type that extends `T` with `ocxKey`, allowing `T` to have arbitrary key-value pairs. */ export type ocxReturn = T & ocxKey; type ocxAcc = T & ocxKey; /** * A flexible mapping type that can be an: * - plain object (`ocxKey`) * - array of objects (`ocxKey[]`) * - recursive mapping (`ocxMap[]`) * - primitive value (`string`, `number`, `null`, `boolean`, `undefined`) * - function that takes an optional object (`ocxKey`) and returns an `ocxMap`. */ export type ocxMap = ocxKey | ocxKey[] | ocxMap[] | string | number | null | boolean | undefined | ((key?: ocxKey) => ocxMap); /** An object that can be processed by `ocx`. */ export type ocxObj = T | ocxMap | ocxAcc; /** * Checks if a given value is a plain object (i.e., not an array or null). * @param value - The value to check. * @returns True if the value is a plain object, otherwise false. */ export declare function isPlainObject(value: unknown): value is ocxKey; /** * Merges multiple objects deeply, handling arrays and functions gracefully. * @template T - The base object type. * @param obj - One or more objects to merge. * @returns The deeply merged object. */ declare function ocxRaw(...obj: ocxObj[]): ocxReturn; /** * Merges multiple objects deeply, handling arrays and functions gracefully **without overwriting**. * @template T - The base ocx type. * @param obj - One or more objects to merge. * @returns The deeply merged object **without overwriting** the value at the first key, only change the value if it does not exist. */ declare function ocxPreserve(...obj: ocxObj[]): ocxReturn; /** * Recursively removes falsy values from an object, except those specified in `exclude`. * @template T - The ocx type. * @param obj - The object to clean. * @param exclude - An array of values to be preserved even if they are falsy (default: `[]`). * @param seen - To detect cyclic references (default: `new WeakSet()`). * @returns A new object without the falsy values. * @example * @see {@link https://ilkhoeri.github.io/xuxi/clean Docs} */ declare function ocxClean(obj: T, exclude?: unknown[], seen?: WeakSet): T; /** * Recursively merge objects with support for arrays, dynamic functions, and non falsy properties into a single object. * * Provides a chaining: * - {@link ocxRaw raw} method to **get falsy values** from the result. * - {@link ocxPreserve preserve} method to join **without overwriting** first value. * @example * @see {@link https://ilkhoeri.github.io/xuxi/?id=ocx Docs} */ declare function ocx(...obj: ocxObj[]): ocxReturn; declare namespace ocx { var raw: typeof ocxRaw; var preserve: typeof ocxPreserve; var clean: typeof ocxClean; } export { ocx, ocxClean as clean };