@appsemble/lang-sdk
Version:
Language SDK for Appsemble
39 lines (38 loc) • 1.22 kB
TypeScript
/**
* 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;
/**
* Check if the target has an own property named after the key.
*
* @param target The target that should have the key. Null values are also accepted.
* @param key The key to check for on the target.
* @returns Whether or not the key exists on the target.
*/
export declare function has(target: object | null | undefined, key: string): boolean;