cafe-utility 33.3.0 → 33.3.2
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/index.js +2 -1
- package/package.json +1 -1
package/index.js
CHANGED
|
@@ -288,6 +288,7 @@ function binomialSample(n, e, t = Math.random) {
|
|
|
288
288
|
}
|
|
289
289
|
function toSignificantDigits(n, e) {
|
|
290
290
|
if (!n.includes('.')) return n
|
|
291
|
+
if (parseFloat(n) === 0) return '0'
|
|
291
292
|
const [t, r] = n.split('.'),
|
|
292
293
|
o = t.replace('-', ''),
|
|
293
294
|
i = o.length
|
|
@@ -429,7 +430,7 @@ function asNumber(n, e) {
|
|
|
429
430
|
return e && checkLimits(t, e), t
|
|
430
431
|
}
|
|
431
432
|
function asInteger(n, e) {
|
|
432
|
-
return asNumber(n, e)
|
|
433
|
+
return Math.trunc(asNumber(n, e))
|
|
433
434
|
}
|
|
434
435
|
function asBoolean(n, e) {
|
|
435
436
|
if (n === 'true') return !0
|