UNPKG

@appsemble/utils

Version:

Utility functions used in Appsemble internally

31 lines (30 loc) 863 B
/** * Return the input data. * * @param data The data to return. * @returns The input data. */ export declare function identity<T>(data: T): T; /** * Throw the input data. * * @param data The data to throw. * @throws The input data. */ export declare function rethrow(data: unknown): never; export interface StripNullValuesOptions { /** * How deep to recurse into objects and arrays to remove null values. * * @default Infinity */ depth?: number; } /** * Strip all null, undefined, and empty array values from an object. * * @param value The value to strip. * @param options Additional options for stripping null values. * @returns A copy of the input, but with all nullish values removed recursively. */ export declare function stripNullValues(value: unknown, { depth, ...options }?: StripNullValuesOptions): unknown;