forked from plexidev/quick.db
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathindex.d.ts
More file actions
89 lines (76 loc) · 3.5 KB
/
index.d.ts
File metadata and controls
89 lines (76 loc) · 3.5 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
/**
* Definitions by: Zoro <admin@zoro.tech>
*/
declare module 'quick.db' {
/**
* This function fetches data from a key in the database. (alias: .get())
* @param {key} input any string as a key. Also allows for dot notation following the key.
* @param {options} [input={ target: null }] Any options to be added to the request.
* @returns {data} the data requested.
*/
function fetch(key: string, ops?: object): any;
function get(key: string, ops?: object): any;
/**
* This function sets new data based on a key in the database.
* @param {key} input any string as a key. Also allows for dot notation following the key.
* @param {options} [input={ target: null }] Any options to be added to the request.
* @returns {data} the updated data.
*/
function set(key: string, value: string|object|Array<any>, ops?: object): any;
/**
* This function adds a number to a key in the database. (If no existing number, it will add to 0)
* @param {key} input any string as a key. Also allows for dot notation following the key.
* @param {options} [input={ target: null }] Any options to be added to the request.
* @returns {data} the updated data.
*/
function add(key: string, value: number, ops?: object): any;
/**
* This function subtracts a number to a key in the database. (If no existing number, it will subtract from 0)
* @param {key} input any string as a key. Also allows for dot notation following the key.
* @param {options} [input={ target: null }] Any options to be added to the request.
* @returns {data} the updated data.
*/
function subtract(key: string, value: number, ops?: object): any;
/**
* This function will push into an array in the database based on the key. (If no existing array, it will create one)
* @param {key} input any string as a key. Also allows for dot notation following the key.
* @param {options} [input={ target: null }] Any options to be added to the request.
* @returns {data} the updated data.
*/
function push(key: string, value: string|object|Array<any>): Array<any>;
/**
* This function returns a boolean indicating whether an element with the specified key exists or not.
* @param {key} input any string as a key. Also allows for dot notation following the key, this will return if the prop exists or not.
* @param {options} [input={ target: null }] Any options to be added to the request.
* @returns {boolean} if it exists.
*/
function has(key: string, ops?: object): boolean;
function includes(key: string, ops?: object): boolean;
/**
* This function fetches the entire active table
* @param {options} [input={ target: null }] Any options to be added to the request.
* @returns {boolean} if it exists.
*/
function all(ops?: object): boolean;
function fetchAll(ops?: object): boolean;
/**
* This function will delete an object (or property) in the database.
* @param {key} input any string as a key. Also allows for dot notation following the key, this will delete the prop in the object.
* @param {options} [input={ target: null }] Any options to be added to the request.
* @returns {boolean} if it was a success or not.
*/
function del(key: string, ops?:object): boolean;
export {
fetch,
get,
set,
add,
subtract,
push,
has,
includes,
all,
fetchAll,
del as delete
}
}