forked from DefinitelyTyped/DefinitelyTyped
-
Notifications
You must be signed in to change notification settings - Fork 0
/
hashids.d.ts
36 lines (32 loc) · 1.11 KB
/
hashids.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
// Type definitions for Hashids.js 1.x
// Project: https://github.com/ivanakimov/hashids.node.js
// Definitions by: Paulo Cesar <https://github.com/pocesar/>
// Definitions: https://github.com/borisyankov/DefinitelyTyped
/// <reference path="../node/node.d.ts" />
declare module Hashids {
export interface IHashids {
new(salt: string, minHashLength?: number, alphabet?: string): IHashids;
version: string;
minAlphabetLength: number;
sepDiv: number;
guardDiv: number;
errorAlphabetLength: string;
errorAlphabetSpace: string;
alphabet: string[];
seps: string;
minHashLength: number;
salt: string;
decode(hash: string): number[];
encode(arg: number): string;
encode(arg: number[]): string;
encode(...args: number[]): string;
encodeHex(str: string): string;
decodeHex(hash: string): string;
hash(input: number, alphabet: string): string;
unhash(input: string[], alphabet: string): number;
}
}
declare module 'hashids' {
var hashids: Hashids.IHashids;
export = hashids;
}