Update strings.js

This commit is contained in:
Namhyeon Go 2022-04-20 14:04:18 +09:00 committed by GitHub
parent 3b0731d010
commit d29a9f239e
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -2,7 +2,7 @@
* strings.js
*/
module.number_format = function(number, decimals, decPoint, thousandsSep) { // eslint-disable-line camelcase
var number_format = function(number, decimals, decPoint, thousandsSep) { // eslint-disable-line camelcase
// discuss at: https://locutus.io/php/number_format/
// original by: Jonas Raoni Soares Silva (https://www.jsfromhell.com)
// improved by: Kevin van Zonneveld (https://kvz.io)
@ -58,7 +58,7 @@ module.number_format = function(number, decimals, decPoint, thousandsSep) { // e
const sep = (typeof thousandsSep === 'undefined') ? ',' : thousandsSep
const dec = (typeof decPoint === 'undefined') ? '.' : decPoint
let s = ''
const toFixedFix = function (n, prec) {
const toFixedFix = function(n, prec) {
if (('' + n).indexOf('e') === -1) {
return +(Math.round(n + 'e+' + prec) + 'e-' + prec)
} else {
@ -81,3 +81,5 @@ module.number_format = function(number, decimals, decPoint, thousandsSep) { // e
}
return s.join(dec)
}
exports.number_format = number_format;