commafy.d.ts 992 B

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