forked from karbassi/stormdb
-
Notifications
You must be signed in to change notification settings - Fork 0
/
index.d.ts
38 lines (33 loc) · 1.13 KB
/
index.d.ts
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
declare module 'stormdb' {
class StormDB {
constructor(engine: LocalFileEngine, options?: object);
static browserEngine: typeof BrowserEngine;
static localFileEngine: typeof LocalFileEngine;
default(defaultValue: object): StormDB;
length(): StormDB;
delete(reindexLists: boolean): void;
push(value: any): void;
get(value: any): StormDB;
set(key: any, value?: any): StormDB;
map<T>(func: (value: any, index?: number, array?: any[]) => T): StormDB;
sort<T>(func: (a: T, b: T) => number): StormDB;
filter<T, S extends T>(func: (value: T, index?: number, array?: T[]) => value is S): StormDB;
reduce(func: any): StormDB;
value(): any;
setValue(value: any, pointers: any[], setRecursively?: boolean): void;
save(): Promise<void> | null;
}
class LocalFileEngine {
constructor(path: string, options?: object);
init(): object;
read(): object;
write(data: any): Promise<void> | null;
}
class BrowserEngine {
constructor(path: string, options?: object);
init(): object;
read(): object;
write(data: any): Promise<void> | null;
}
export = StormDB;
}