-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathindex.d.ts
32 lines (28 loc) · 1.17 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
declare module 'public-id' {
interface PublicIdOptions {
key?: string;
index?: string;
defaultIdLength?: number;
signatureLength?: number;
randomFunction?: () => Promise<number>;
}
function publicId(id: number, length?: number, random?: number[] | (() => Promise<number>)): Promise<string>;
function publicId(id: string): Promise<number>;
namespace publicId {
export function configure(options: PublicIdOptions);
export function resetConfiguration();
export function maxId(length?: number): number;
export class PublicIdGenerator {
constructor(options?: PublicIdOptions);
configure(options: PublicIdOptions): this;
resetConfiguration(): this;
maxId(length?: number): number;
publicId(id: number, length?: number, random?: number[] | (() => Promise<number>)): Promise<string>;
generate(id: number, length?: number, random?: number[] | (() => Promise<number>)): Promise<string>;
encode(id: number, length?: number, random?: number[] | (() => Promise<number>)): Promise<string>;
publicId(id: string): Promise<number>;
decode(id: string): Promise<number>;
}
}
export = publicId;
}