mirror of
https://github.com/gnh1201/welsonjs.git
synced 2025-05-09 21:26:04 +00:00
Update strings.js
This commit is contained in:
parent
3b0731d010
commit
d29a9f239e
|
@ -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;
|
||||
|
|
Loading…
Reference in New Issue
Block a user