-
Notifications
You must be signed in to change notification settings - Fork 134
/
Copy pathnzh.d.ts
74 lines (70 loc) · 1.68 KB
/
nzh.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
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
interface Options {
/*
* 十的口语化开关, 默认值为 false
* 注: Nzh.cn和Nzh.hk中的encodeS方法默认 true
* */
tenMin?: boolean;
/**
* "万万"化开关, 默认值为 true
* */
ww?: boolean;
}
interface ToMoneyOptions extends Options {
/**
* 输出完整金额开关, toMoney 函数专用配置, 默认 false
* */
complete?: boolean;
/*
* 输出金额前缀字符, toMoney 函数专用配置, 默认 true
* */
outSymbol?: boolean;
/*
* 个位为0时不省略元,toMoney 函数专用配置, 默认 false
* */
unOmitYuan?: boolean;
/**
* 不以源数据加整,以输出结果加“整”(只要输出的结果没有到分位就加“整”)
*/
forceZheng?: boolean;
}
interface Lang {
ch: string;
ch_u: string;
ch_f: string;
ch_d: string;
m_t: string;
m_z: string;
m_u: string;
}
interface Langs {
s: Lang;
b: Lang;
hk_s: Lang;
hk_b: Lang;
}
interface BuiltIn {
encodeS(num: number | string, options?: Options): string;
encodeB(num: number | string, options?: Options): string;
decodeS(zhnum: string, options?: Options): string;
decodeB(zhnum: string, options?: Options): string;
toMoney(num: number | string, options?: ToMoneyOptions): string;
}
declare module 'nzh' {
export default class Nzh {
constructor(lang: Lang);
public encode(num: number | string, options?: Options): string;
public decode(zhnum: string, options?: Options): string;
public toMoney(num: number | string, options?: ToMoneyOptions): string;
static cn: BuiltIn;
static hk: BuiltIn;
static langs: Langs;
}
}
declare module 'nzh/cn' {
const nzhcn:BuiltIn;
export default nzhcn;
}
declare module 'nzh/hk' {
const nzhhk:BuiltIn;
export default nzhhk;
}