tedb
Version:
TypeScript Embedded Database
76 lines (75 loc) • 1.65 kB
TypeScript
/**
* Replace a value
*
* Example:
* ~~~
* let obj = {nested: {layer1: {}}};
* $set(obj, {"nexted.layer1.newSet": "value"})
* .then((res) => console.log(res)) // {nested: {layer: {newSet: "value"}}}
* .catch();
* ~~~
* @param obj
* @param set
* @returns {Promise<T>}
*/
export declare const $set: (obj: any, set: any) => Promise<any>;
/**
* Multiply a value
*
* Example:
* ~~~
* let obj = {nested: {num: 2}};
* $mul(obj, {"nested.num": 3})
* .then((res) => console.log(res)) // {nested: {num: 6}}
* .catch();
* ~~~
* @param obj
* @param mul
* @returns {Promise<T>}
*/
export declare const $mul: (obj: any, mul: any) => Promise<any>;
/**
* Increment a value or subtract from a value.
*
* Example:
* ~~~
* let obj = {nested: {num: 1}};
* $inc(obj, {"nested.num": -1})
* .then((res) => console.log(res)) // {nested: {num: 0}}
* .catch();
* ~~~
* @param obj
* @param inc
* @returns {Promise<T>}
*/
export declare const $inc: (obj: any, inc: any) => Promise<any>;
/**
* Remove key/value
*
* Example:
* ~~~
* let obj = {nested: {v: "value}};
* $unset(obj, {"nested.v": ""})
* .then((res) => console.log(res)) // {nested: {}}
* .catch();
* ~~~
* @param obj
* @param unset
* @returns {Promise<T>}
*/
export declare const $unset: (obj: any, unset: any) => Promise<any>;
/**
* Rename a key
*
* Example:
* ~~~
* let obj = {nested: {v: "value"}};
* $rename(obj, {"nested.v": "key"})
* .then((res) => console.log(res)) // {nested: {key: "value"}}
* .catch();
* ~~~
* @param obj
* @param rename
* @returns {Promise<T>}
*/
export declare const $rename: (obj: any, rename: any) => Promise<any>;