@dune2/tools 1.0.0 → 1.0.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/package.json +1 -1
- package/src/numbro/index.ts +7 -4
package/package.json
CHANGED
package/src/numbro/index.ts
CHANGED
|
@@ -273,10 +273,13 @@ export class Numbro {
|
|
|
273
273
|
}
|
|
274
274
|
|
|
275
275
|
if (shouldDeleteEndZero) {
|
|
276
|
-
|
|
277
|
-
|
|
278
|
-
|
|
279
|
-
|
|
276
|
+
const isDecimal = outputFormat.includes(".");
|
|
277
|
+
if (isDecimal) {
|
|
278
|
+
// 移除尾数 0
|
|
279
|
+
// outputFormat = outputFormat.replace(/\.?0+$/, "");
|
|
280
|
+
const reg = new RegExp(`\\.?0+${suffix}$`);
|
|
281
|
+
outputFormat = outputFormat.replace(reg, suffix);
|
|
282
|
+
}
|
|
280
283
|
}
|
|
281
284
|
return outputFormat;
|
|
282
285
|
}
|