Socket
Socket
Sign inDemoInstall

xmcommon

Package Overview
Dependencies
1
Maintainers
1
Versions
65
Alerts
File Explorer

Advanced tools

Install Socket

Detect and block malicious and high-risk dependencies

Install

Comparing version 0.9.11 to 0.9.12

5

dist/cnycurrency.d.ts

@@ -151,7 +151,8 @@ /** 大写的Chinese函数参数选项 */

* @param {boolean} paramUseSymbol 是否带有"¥"符号
* @param {*} paramCNYsplit 是否以中文四数字一组
* @param {boolean} paramCNYsplit 是否以中文四数字一组
* @param {boolean} paramHasSplit 是否存在千分位分隔符
* @return {string} 生成后的字符串
*/
format(paramUseSymbol?: boolean, paramCNYsplit?: boolean): string;
format(paramUseSymbol?: boolean, paramCNYsplit?: boolean, paramHasSplit?: boolean): string;
toJSON(): number;
}

17

dist/cnycurrency.js

@@ -474,6 +474,7 @@ "use strict";

* @param {boolean} paramUseSymbol 是否带有"¥"符号
* @param {*} paramCNYsplit 是否以中文四数字一组
* @param {boolean} paramCNYsplit 是否以中文四数字一组
* @param {boolean} paramHasSplit 是否存在千分位分隔符
* @return {string} 生成后的字符串
*/
format(paramUseSymbol = false, paramCNYsplit = false) {
format(paramUseSymbol = false, paramCNYsplit = false, paramHasSplit = true) {
const value = Math.abs(this.value);

@@ -483,8 +484,10 @@ const values = value.toFixed(2).split('.');

const cent = values[1];
if (paramCNYsplit) {
yuan = yuan.replace(groupCNYReg, '$1,');
if (paramHasSplit) {
if (paramCNYsplit) {
yuan = yuan.replace(groupCNYReg, '$1,');
}
else {
yuan = yuan.replace(groupReg, '$1,');
}
}
else {
yuan = yuan.replace(groupReg, '$1,');
}
let negative = '';

@@ -491,0 +494,0 @@ if (this.m_intValue < 0) {

@@ -480,16 +480,20 @@ // const _ = require("lodash");

* @param {boolean} paramUseSymbol 是否带有"¥"符号
* @param {*} paramCNYsplit 是否以中文四数字一组
* @param {boolean} paramCNYsplit 是否以中文四数字一组
* @param {boolean} paramHasSplit 是否存在千分位分隔符
* @return {string} 生成后的字符串
*/
public format(paramUseSymbol = false, paramCNYsplit = false) {
public format(paramUseSymbol = false, paramCNYsplit = false, paramHasSplit = true) {
const value = Math.abs(this.value);
const values = value.toFixed(2).split('.');
let yuan = values[0];
const cent = values[1];
if (paramHasSplit) {
if (paramCNYsplit) {
yuan = yuan.replace(groupCNYReg, '$1,');
} else {
yuan = yuan.replace(groupReg, '$1,');
}
}
if (paramCNYsplit) {
yuan = yuan.replace(groupCNYReg, '$1,');
} else {
yuan = yuan.replace(groupReg, '$1,');
}
let negative = '';

@@ -496,0 +500,0 @@ if (this.m_intValue < 0) {

{
"name": "xmcommon",
"version": "0.9.11",
"description": "javascript common lib for es6",
"version": "0.9.12",
"description": "一个基于javascript的常用功能扩展库!",
"main": "./dist/index.js",

@@ -44,6 +44,6 @@ "scripts": {

"@typescript-eslint/parser": "^5.4.0",
"eslint": "^8.2.0",
"eslint": "^8.3.0",
"eslint-config-google": "^0.14.0",
"prettier": "^2.4.1",
"prettier-eslint": "^13.0.0",
"prettier": "^2.5.0",
"prettier-eslint": "^8.2.2",
"typescript-tslint-plugin": "^1.0.1"

@@ -50,0 +50,0 @@ },

@@ -39,2 +39,6 @@ # xmcommon

# 版本变更说明
## 0.9.12
- 2021-11-29
- \* CNYCurrency类的format方法,增加无千分位分隔符的参数
## 0.9.11

@@ -41,0 +45,0 @@ - 2021-11-16

SocketSocket SOC 2 Logo

Product

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

Packages

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc