Huge News!Announcing our $40M Series B led by Abstract Ventures.Learn More
Socket
Sign inDemoInstall
Socket

xmcommon

Package Overview
Dependencies
Maintainers
1
Versions
65
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

xmcommon - npm Package Compare versions

Comparing version 0.0.15 to 0.0.16

16

lib/cnycurrency.js

@@ -77,9 +77,9 @@

* //输出结果
* //-12345 -1234500 -12345.00 ¥-1,2345.00 负壹万贰千叁佰肆拾伍元整
* //97654 9765400 97654.00 ¥9,7654.00 玖万柒千陆佰伍拾肆元整
* //-12355 -1235500 -12355.00 ¥-1,2355.00 负壹万贰千叁佰伍拾伍元整
* //-1234500 -123450000 -1234500.00 ¥-123,4500.00 负壹佰贰拾叁万肆千伍佰元整
* //-123450 -12345000 -123450.00 ¥-12,3450.00 负拾贰万叁千肆佰伍拾元整
* //-12345 -1234500 -12345.00 ¥-1,2345.00 负壹万贰仟叁佰肆拾伍元整
* //97654 9765400 97654.00 ¥9,7654.00 玖万柒仟陆佰伍拾肆元整
* //-12355 -1235500 -12355.00 ¥-1,2355.00 负壹万贰仟叁佰伍拾伍元整
* //-1234500 -123450000 -1234500.00 ¥-123,4500.00 负壹佰贰拾叁万肆仟伍佰元整
* //-123450 -12345000 -123450.00 ¥-12,3450.00 负拾贰万叁仟肆佰伍拾元整
* //-123.45 -12345 -123.45 ¥-123.45 负壹佰贰拾叁元肆角伍分
* //13215236.49 1321523649 13215236.49 ¥1321,5236.49 壹千叁佰贰拾壹万伍千贰佰叁拾陆元肆角玖分
* //13215236.49 1321523649 13215236.49 ¥1321,5236.49 壹仟叁佰贰拾壹万伍仟贰佰叁拾陆元肆角玖分
*/

@@ -267,3 +267,3 @@ class CNYCurrency {

let n = Math.abs(this.value).toFixed(2);;
let unit = "千佰拾京千佰拾兆千佰拾亿千佰拾万千佰拾元角分";
let unit = "仟佰拾京仟佰拾兆仟佰拾亿仟佰拾万仟佰拾元角分";
let str = "";

@@ -283,3 +283,3 @@

}
return negative + str.replace(/零(千|百|拾|角)/g, "零").replace(/(零)+/g, "零").replace(/零(万|亿|元)/g, "$1").replace(/(亿)万|壹(拾)/g, "$1$2").replace(/^元零?|零分/g, "").replace(/元$/g, "元整");
return negative + str.replace(/零(仟|百|拾|角)/g, "零").replace(/(零)+/g, "零").replace(/零(万|亿|元)/g, "$1").replace(/(亿)万|壹(拾)/g, "$1$2").replace(/^元零?|零分/g, "").replace(/元$/g, "元整");
}

@@ -286,0 +286,0 @@ /**

{
"name": "xmcommon",
"version": "0.0.15",
"version": "0.0.16",
"description": "javascript common lib for es6",

@@ -5,0 +5,0 @@ "main": "index.js",

# xmcommon
一个js 通用库

@@ -8,5 +9,7 @@

## 安装
npm install xmcommon
# 主要模块说明
- datetimeUtils 日期时间相关的处理工具函数

@@ -24,5 +27,38 @@ - utils 一些常用的工具类函数

- bitUtils 二进制标志的工具类
- CNYCurrency 中文货币类
# 版本变更说明
## 0.0.16
- 2019-06-03
- \* 修复生成大写的bug,主要是百==>佰 千==>仟
```js
let m = [];
let c = new CNYCurrency(-12345);
m.push(c);
m.push(c.add(109999));
m.push(c.sub(10));
m.push(c.div(0.01));
m.push(c.mul(10));
m.push(c.mul(0.01));
let tt = new CNYCurrency(0);
tt.selfAdd(2805307.04);
tt.selfAdd(4323515.28);
tt.selfAdd(2805307.04);
tt.selfAdd(3281107.13);
m.push(tt);
for(let mm of m) {
console.log(mm.value, mm.intValue, mm.toString(), mm.format(true, true), mm.Chinese());
}
//输出结果
//-12345 -1234500 -12345.00 ¥-1,2345.00 负壹万贰仟叁佰肆拾伍元整
//97654 9765400 97654.00 ¥9,7654.00 玖万柒仟陆佰伍拾肆元整
//-12355 -1235500 -12355.00 ¥-1,2355.00 负壹万贰仟叁佰伍拾伍元整
//-1234500 -123450000 -1234500.00 ¥-123,4500.00 负壹佰贰拾叁万肆仟伍佰元整
//-123450 -12345000 -123450.00 ¥-12,3450.00 负拾贰万叁仟肆佰伍拾元整
//-123.45 -12345 -123.45 ¥-123.45 负壹佰贰拾叁元肆角伍分
//13215236.49 1321523649 13215236.49 ¥1321,5236.49 壹仟叁佰贰拾壹万伍仟贰佰叁拾陆元肆角玖分
```
## 0.0.15

@@ -29,0 +65,0 @@ - 2019-06-01

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc