@fnmain/number
Advanced tools
Comparing version 1.6.0 to 1.6.1
@@ -119,5 +119,5 @@ "use strict"; | ||
} | ||
return val.toString().replace(/(?<!\.\d*)(?=(\d{3})+(?!\d))/g, ","); | ||
return val.toString().replace(/\B(?=(\d{3})+(?!\d))/g, ","); | ||
} | ||
exports.formatWithCommas = formatWithCommas; | ||
//# sourceMappingURL=index.js.map |
@@ -31,6 +31,7 @@ "use strict"; | ||
console.log((0, index_1.isNotNumber)(null)); // true | ||
console.log((0, index_1.formatWithCommas)(12345.6789)); // 12,345.6789 | ||
console.log((0, index_1.formatWithCommas)("12345.6789")); // 12,345.6789 | ||
console.log((0, index_1.formatWithCommas)(12345.6789)); // 12,345.678,9 | ||
console.log((0, index_1.formatWithCommas)("12345.6789")); // 12,345.678,9 | ||
console.log((0, index_1.formatWithCommas)("123")); // 123 | ||
console.log((0, index_1.formatWithCommas)("abc")); // "NaN" | ||
console.log((0, index_1.formatWithCommas)("abc", { strNaN: "" })); // "" | ||
//# sourceMappingURL=test.js.map |
{ | ||
"name": "@fnmain/number", | ||
"version": "1.6.0", | ||
"version": "1.6.1", | ||
"description": "number utils", | ||
@@ -5,0 +5,0 @@ "main": "dist/index.js", |
@@ -143,3 +143,3 @@ type Options = { | ||
} | ||
return val.toString().replace(/(?<!\.\d*)(?=(\d{3})+(?!\d))/g, ","); | ||
return val.toString().replace(/\B(?=(\d{3})+(?!\d))/g, ","); | ||
} |
@@ -35,5 +35,6 @@ import { formatWithCommas, isNotNumber, isNumber, parseNumber, toAuto, toPercent } from "./index"; | ||
console.log(formatWithCommas(12345.6789)); // 12,345.6789 | ||
console.log(formatWithCommas("12345.6789")); // 12,345.6789 | ||
console.log(formatWithCommas(12345.6789)); // 12,345.678,9 | ||
console.log(formatWithCommas("12345.6789")); // 12,345.678,9 | ||
console.log(formatWithCommas("123")); // 123 | ||
console.log(formatWithCommas("abc")); // "NaN" | ||
console.log(formatWithCommas("abc", { strNaN: "" })); // "" |
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
21642
336