@happys/money-format
TypeScript icon, indicating that this package has built-in type declarations

1.2.9 • Public • Published

npm
unpkg:https://unpkg.com/@happys/money-format@latest/dist/format.min.js

Installation

npm install @happys/money-format
or 
yarn add @happys/money-format

##Usage

import { format } from '@happys/money-format';

const result = format(1234567);
console.log(result);

1,234,567.00
import { RMB } from '@happys/money-format';

const result = RMB(10010);
console.log(result);


壹万零壹拾元整

##Example

<script type="text/javascript" src="https://unpkg.com/@happys/money-format@latest/dist/format.min.js"></script>

<script>
    var result = moneyFormat.format(1234567);
    var rmb =  moneyFormat.RMB(10010);
</script>

##Api

format(money, options)
  • money

    • type: number | string
  • options

    • type: {}
{
    // 小数位数
    // default  2
    decimal?: number;

    // 分割符
    // default  ,
    delimiter?: string;

    // 分位数
    // default  3
    digit?: number | boolean;

    // 四舍五入
    // default  true
    round?: boolean;

}
RMB(money, options)
  • money

    • type: number | string
  • options

    • type: {}
{
    // 前缀
    // default ''
    prefix?: string;

    // 负数字符串
    // default '负'
    negativeStr?: string | boolean;

    // 整数字符串
    // default  '整'
    integerStr?: string;
}

Package Sidebar

Install

npm i @happys/money-format

Weekly Downloads

38

Version

1.2.9

License

ISC

Unpacked Size

11.4 kB

Total Files

9

Last publish

Collaborators

  • happys