UNPKG

852 BTypeScriptView Raw
1export interface CommafyOptions {
2 /**
3 * 分割位数,默认3
4 */
5 spaceNumber?: number;
6 /**
7 * 分隔符,默认','
8 */
9 separator?: string;
10 /**
11 * 只对 number 类型有效,小数位数,默认null
12 */
13 digits?: number;
14 /**
15 * 只对 number 类型有效,四舍五入,默认true
16 */
17 round?: boolean;
18 /**
19 * 只对 number 类型有效,向上舍入
20 */
21 ceil?: boolean;
22 /**
23 * 只对 number 类型有效,向下舍入
24 */
25 floor?: boolean;
26}
27
28/**
29 * 数值千分位分隔符、小数点
30 * @param num 数值/字符串
31 * @param options 可选参数
32 */
33export declare function commafy(num: string | number, options?: CommafyOptions): string;
34
35declare module './ctor' {
36 interface XEUtilsMethods {
37 commafy: typeof commafy;
38 }
39}
40
41export default commafy