js-number-to-local-string
v1.0.6
Published
js数字转千分位字符串
Downloads
4
Readme
Example Usage
import toLocalString from 'js-number-to-local-string';
// const toLocalString = require('js-number-to-local-string');
toLocalString() --> '0.00';
toLocalString(1) --> '1.00';
toLocalString(1.0) --> '1.00';
toLocalString(-1.0) --> '-1.00';
toLocalString(1000.0) --> '1,000.00';
toLocalString(-1000.0) --> '-1,000.00';
toLocalString(1000.1) --> '1,000.10';
toLocalString(1000.1111) --> '1,000.1111';
toLocalString('') --> '0.00';
toLocalString(null) --> '0.00';
toLocalString(undefined) --> '0.00';
toLocalString('1.0.1') --> 'Invalid number' --> '0.00';
toLocalString('-100..0') --> 'Invalid number' --> '0.00';
toLocalString(window) --> 'Invalid number [object Window]' --> '0.00';
toLocalString(function () {}) --> 'Invalid number function () {}' --> '0.00';