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

fe-utils

Package Overview
Dependencies
Maintainers
1
Versions
18
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

fe-utils - npm Package Compare versions

Comparing version 1.0.0 to 1.0.2

29

fe-utils.js

@@ -155,6 +155,8 @@ (function (global, factory) {

var chnNumChar = ['零', '一', '二', '三', '四', '五', '六', '七', '八', '九'];
var chTwNumChar = ['零', '壹', '贰', '叁', '肆', '伍', '陆', '柒', '捌', '玖', '拾'];
var chnUnitSection = ['', '万', '亿', '万亿', '亿亿'];
var chnUnitChar = ['', '十', '百', '千'];
var chTwUnitChar = ['', '十', '佰', '仟'];
var SectionToChinese = function SectionToChinese(section) {
var SectionToChinese = function SectionToChinese(section, isBig5) {
var strIns = '';

@@ -164,2 +166,10 @@ var chnStr = '';

var zero = true;
var numChar = chnNumChar;
var unitChar = chnUnitChar;
if (isBig5) {
numChar = chTwNumChar;
unitChar = chTwUnitChar;
}
while (section > 0) {

@@ -170,8 +180,8 @@ var v = section % 10;

zero = true;
chnStr = chnNumChar[v] + chnStr;
chnStr = numChar[v] + chnStr;
}
} else {
zero = false;
strIns = chnNumChar[v];
strIns += chnUnitChar[unitPos];
strIns = numChar[v];
strIns += unitChar[unitPos];
chnStr = strIns + chnStr;

@@ -185,3 +195,3 @@ }

var NumberToChinese = function NumberToChinese(num) {
var NumberToChinese = function NumberToChinese(num, isBig5) {
var unitPos = 0;

@@ -191,3 +201,8 @@ var strIns = '';

var needZero = false;
var numChar = chnNumChar;
if (isBig5) {
numChar = chTwNumChar;
}
if (num === 0) {

@@ -200,5 +215,5 @@ return chnNumChar[0];

if (needZero) {
chnStr = chnNumChar[0] + chnStr;
chnStr = numChar[0] + chnStr;
}
strIns = SectionToChinese(section);
strIns = SectionToChinese(section, isBig5);
strIns += section !== 0 ? chnUnitSection[unitPos] : chnUnitSection[0];

@@ -205,0 +220,0 @@ chnStr = strIns + chnStr;

const chnNumChar = ['零', '一', '二', '三', '四', '五', '六', '七', '八', '九']
const chTwNumChar = ['零', '壹', '贰', '叁', '肆', '伍', '陆', '柒', '捌', '玖', '拾']
const chnUnitSection = ['', '万', '亿', '万亿', '亿亿']
const chnUnitChar = ['', '十', '百', '千']
const chTwUnitChar = ['', '十', '佰', '仟']
const SectionToChinese = section => {
const SectionToChinese = (section, isBig5) => {
let strIns = ''

@@ -10,2 +12,10 @@ let chnStr = ''

let zero = true
let numChar = chnNumChar
let unitChar = chnUnitChar
if (isBig5) {
numChar = chTwNumChar
unitChar = chTwUnitChar
}
while (section > 0) {

@@ -16,8 +26,8 @@ let v = section % 10

zero = true
chnStr = chnNumChar[v] + chnStr
chnStr = numChar[v] + chnStr
}
} else {
zero = false
strIns = chnNumChar[v]
strIns += chnUnitChar[unitPos]
strIns = numChar[v]
strIns += unitChar[unitPos]
chnStr = strIns + chnStr

@@ -31,3 +41,3 @@ }

const NumberToChinese = num => {
const NumberToChinese = (num, isBig5) => {
let unitPos = 0

@@ -37,3 +47,8 @@ let strIns = ''

let needZero = false
let numChar = chnNumChar
if (isBig5) {
numChar = chTwNumChar
}
if (num === 0) {

@@ -46,5 +61,5 @@ return chnNumChar[0]

if (needZero) {
chnStr = chnNumChar[0] + chnStr
chnStr = numChar[0] + chnStr
}
strIns = SectionToChinese(section)
strIns = SectionToChinese(section, isBig5)
strIns += (section !== 0) ? chnUnitSection[unitPos] : chnUnitSection[0]

@@ -51,0 +66,0 @@ chnStr = strIns + chnStr

var chnNumChar = ['零', '一', '二', '三', '四', '五', '六', '七', '八', '九'];
var chTwNumChar = ['零', '壹', '贰', '叁', '肆', '伍', '陆', '柒', '捌', '玖', '拾'];
var chnUnitSection = ['', '万', '亿', '万亿', '亿亿'];
var chnUnitChar = ['', '十', '百', '千'];
var chTwUnitChar = ['', '十', '佰', '仟'];
var SectionToChinese = function SectionToChinese(section) {
var SectionToChinese = function SectionToChinese(section, isBig5) {
var strIns = '';

@@ -10,2 +12,10 @@ var chnStr = '';

var zero = true;
var numChar = chnNumChar;
var unitChar = chnUnitChar;
if (isBig5) {
numChar = chTwNumChar;
unitChar = chTwUnitChar;
}
while (section > 0) {

@@ -16,8 +26,8 @@ var v = section % 10;

zero = true;
chnStr = chnNumChar[v] + chnStr;
chnStr = numChar[v] + chnStr;
}
} else {
zero = false;
strIns = chnNumChar[v];
strIns += chnUnitChar[unitPos];
strIns = numChar[v];
strIns += unitChar[unitPos];
chnStr = strIns + chnStr;

@@ -31,3 +41,3 @@ }

var NumberToChinese = function NumberToChinese(num) {
var NumberToChinese = function NumberToChinese(num, isBig5) {
var unitPos = 0;

@@ -37,3 +47,8 @@ var strIns = '';

var needZero = false;
var numChar = chnNumChar;
if (isBig5) {
numChar = chTwNumChar;
}
if (num === 0) {

@@ -46,5 +61,5 @@ return chnNumChar[0];

if (needZero) {
chnStr = chnNumChar[0] + chnStr;
chnStr = numChar[0] + chnStr;
}
strIns = SectionToChinese(section);
strIns = SectionToChinese(section, isBig5);
strIns += section !== 0 ? chnUnitSection[unitPos] : chnUnitSection[0];

@@ -51,0 +66,0 @@ chnStr = strIns + chnStr;

{
"name": "fe-utils",
"version": "1.0.0",
"version": "1.0.2",
"description": "",

@@ -5,0 +5,0 @@ "main": "fe-utils.js",

@@ -1,2 +0,3 @@

# fe-utils v1.0.0
# fe-utils v1.0.2
collect all kinds of utility functions that are often used by us.

@@ -27,9 +28,18 @@ ## Installation

1. NumberToChinese
* NumberToChinese(12345) // '一万二千三百四十五'
* NumberToChinese(12345, true) // '壹万贰仟叁佰肆十伍'
2. cookie
* setCookie(name, domain, domain, expiredays)
* getCookie(name)
* delCookie(name, domain)
3. date
* dateFormat() // dateFormat(new Date(), 'MM月dd日 hh:mm:ss')
4. detectedInfos
5. main
6. preventViewScroll
7. urlQuery
8. toRoman
* isAndroid / isIOS / isWindowPhone / isWX / isWeibo / isMobile / isPC
5. preventViewScroll
6. urlQuery
* queryOne // queryOne('name', ['http://xx.com?name=kevin']) -> 'kevin'
* queryAll // queryOne('http://xx.com?name=kevin&age=18') -> {name: 'kevin', age: 18}
7. toRoman
toRoman(25) // 'XXV'
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