deleight
Version:
A library with 9 modules for writing more expressive web applications with traditional HTML, CSS and JavaScript.
135 lines (134 loc) • 2.62 kB
TypeScript
import { IDeepKey, IKey } from "../../../types.js";
/**
* A proxy for creating deep keys using member access syntax
*
* @example
*
*/
export declare const deepKey: any;
/**
* Alias for {@link deepKey}
*/
export declare const dk: any;
/**
* Given an object and a key or deepkey, returns the object that directly
* holds the member being referred to (.parent) and the member key in
* it (.member).
*
* @example
*
*
* @param object
* @param key
* @returns
*/
export declare function destructure(object: any, key: IDeepKey): {
parent: any;
member: any[] | IKey;
};
/**
* Async equivalent of {@link destructure}. This will resolve
* any promises in the member path, so it returns a Promise that resolves
* to the same type of object as the one returned by {@link destructure}.
*
* @example
*
*
* @param object
* @param key
* @returns
*/
export declare function destructureAsync(object: any, key: IDeepKey): Promise<{
parent: any;
member: any[] | IKey;
}>;
/**
* Gets the member referred to by the object and key/deepkey
*
* @example
*
*
* @param object
* @param key
* @returns
*/
export declare function get(object: any, key: IDeepKey): any;
/**
* Async equivalent of {@link get}
*
* @example
*
*
* @param object
* @param key
* @returns
*/
export declare function getAsync(object: any, key: IDeepKey): Promise<any>;
/**
* Sets the member referred to by the object and key/deepkey
*
* @example
*
*
* @param object
* @param key
* @param value
* @returns
*/
export declare function set(object: any, key: IDeepKey, value: any): any;
/**
* Async equivalent of {@link set}
*
* @example
*
* @param object
* @param key
* @param value
* @returns
*/
export declare function setAsync(object: any, key: IDeepKey, value: any): Promise<any>;
/**
* Calls the method referred to by the object and key/deepkey
*
* @example
*
*
* @param object
* @param key
* @param args
* @returns
*/
export declare function call(object: any, key: IDeepKey, ...args: any[]): any;
/**
* Async equivalent of {@link call}
*
* @example
*
*
* @param object
* @param key
* @param args
* @returns
*/
export declare function callAsync(object: any, key: IDeepKey, ...args: any[]): Promise<any>;
/**
* Deletes the member referred to by the object and key/deepkey
*
* @example
*
*
* @param object
* @param key
* @returns
*/
export declare function del(object: any, key: IDeepKey): void;
/**
* Async equivalent of {@link del}
*
* @example
*
*
* @param object
* @param key
*/
export declare function delAsync(object: any, key: IDeepKey): Promise<void>;