1.2.9 • Published 2 years ago

@happys/money-format v1.2.9

Weekly downloads
6
License
ISC
Repository
github
Last release
2 years ago

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;
}
1.2.8

2 years ago

1.2.7

2 years ago

1.2.6

2 years ago

1.2.5

2 years ago

1.2.9

2 years ago

1.2.4

2 years ago

1.2.3

4 years ago

1.2.2

4 years ago

1.2.1

4 years ago

1.2.0

4 years ago

1.1.0

4 years ago

1.0.1

4 years ago

1.0.0

4 years ago