Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.
import numeral from 'numeral'
numeral.register('format', 'zh-number', {
regexps: {
format: /(zh)/,
unformat: /(zh)/
},
format: function (value, format, roundingFunction) {
// 判断是否有空格
const space = numeral._.includes(format, ' zh') ? ' ' : ''
// match 数据格式
const precision = format.match(/\d.\d+/)
let digits
if (precision) {
// 确定小数点后几位小数
digits = precision[0].split('.')[1].length
}
// check for space before zh
format = format.replace(/\s?\zh/, '');
import numeral from 'numeral'
// referenced from https://github.com/adamwdraper/Numeral-js/pull/534/files
numeral.register('locale', 'sv', {
delimiters: {
thousands: ' ',
decimal: ','
},
abbreviations: {
thousand: 'k',
million: 'm',
billion: 'md',
trillion: 'bn'
},
// http://www.unicode.org/cldr/charts/31/verify/numbers/sv.html
ordinal: function (number) {
const b = number % 10
if ((b === 1 || b === 2) && ((number % 100) !== 11 && (number % 100) !== 12)) {
return ':a'
}
import 'moment/locale/zh-cn';
// 使用numeral对单元格中的数字进行格式化
import numeral from 'numeral';
// YBZSAAS-461
// IE11不支持Array.prototype.find()
import 'core-js/fn/array/find';
// 对MouseEvent进行定义,需要放在全局环境中,方便形成jsdoc文档
/**
* @typedef {Object} MouseEvent
*/
// load a locale
numeral.register('locale', 'chs', {
delimiters: {
thousands: ',',
decimal: '.'
},
abbreviations: {
thousand: '千',
million: '百万',
billion: '十亿',
trillion: '兆'
},
ordinal: (/* number */) => {
return '.';
},
currency: {
symbol: '¥'
}
var nodezip = require("node-zip");
var eletree = require("elementtree");
var fs = require("fs");
var underscore = require("underscore");
var numeral = require('numeral');
var async = require("async");
// load a locale
numeral.register('locale', 'vn', {
delimiters: {
thousands: '.',
decimal: ','
},
abbreviations: {
thousand: 'ngàn',
million: 'triệu',
billion: 'tỷ',
trillion: 'ngàn tỷ'
},
ordinal : function (number) {
return number === 1 ? 'er' : 'ème';
},
currency: {
symbol: 'VND'
}
function initNumeralLocales(lang, locale) {
const language = lang.toLowerCase();
const LOCAL_NUMERAL_FORMAT = {
defaultFormat: '0,0.00[000]',
delimiters: {
thousands: locale.numberGroupingSeparator || ',',
decimal: locale.numberDecimalSeparator || '.',
},
};
if (typeof numeral.locales[language] === 'undefined') {
numeral.register('locale', language, LOCAL_NUMERAL_FORMAT);
}
if (typeof numeral.locales[language] !== 'undefined') {
numeral.locale(language);
if (LOCAL_NUMERAL_FORMAT.defaultFormat) {
numeral.defaultFormat(LOCAL_NUMERAL_FORMAT.defaultFormat);
}
}
}
addLocale(code, language) {
numeral.register('locale', code, language);
}