Skip to content

JavaScript 数字格式化库 numeral.js

Published: at 11:55 AMSuggest Changes

numeral

npm install numeral
var numeral = require('numeral');

var string = numeral(1000).format('0,0');
// '1,000'

var myNumeral = numeral(1000);

var value = myNumeral.value();
// 1000

var myNumeral2 = numeral('1,000');

var value2 = myNumeral2.value();
// 1000

Previous Post
ESLint 忽略@ts-ignore 错误提示
Next Post
CSS 解决 border 影响元素宽高的问题 (box-sizing 属性)