@w3ux/utils 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/index.cjs +3 -3
- package/index.js +3 -3
- package/package.json +1 -1
- package/unit.cjs +3 -3
- package/unit.js +3 -3
package/index.cjs
CHANGED
|
@@ -359,9 +359,9 @@ var unitToPlanck = (val, units) => {
|
|
|
359
359
|
const [integerPart, fractionalPart = ""] = strVal.split(".");
|
|
360
360
|
let bigIntValue = BigInt(integerPart) * BigInt(10) ** BigInt(units);
|
|
361
361
|
if (fractionalPart) {
|
|
362
|
-
const
|
|
363
|
-
const fractionalValue = BigInt(
|
|
364
|
-
bigIntValue += fractionalValue
|
|
362
|
+
const paddedFractional = fractionalPart.padEnd(units, "0");
|
|
363
|
+
const fractionalValue = BigInt(paddedFractional);
|
|
364
|
+
bigIntValue += fractionalValue;
|
|
365
365
|
}
|
|
366
366
|
return bigIntValue;
|
|
367
367
|
} catch (e) {
|
package/index.js
CHANGED
|
@@ -287,9 +287,9 @@ var unitToPlanck = (val, units) => {
|
|
|
287
287
|
const [integerPart, fractionalPart = ""] = strVal.split(".");
|
|
288
288
|
let bigIntValue = BigInt(integerPart) * BigInt(10) ** BigInt(units);
|
|
289
289
|
if (fractionalPart) {
|
|
290
|
-
const
|
|
291
|
-
const fractionalValue = BigInt(
|
|
292
|
-
bigIntValue += fractionalValue
|
|
290
|
+
const paddedFractional = fractionalPart.padEnd(units, "0");
|
|
291
|
+
const fractionalValue = BigInt(paddedFractional);
|
|
292
|
+
bigIntValue += fractionalValue;
|
|
293
293
|
}
|
|
294
294
|
return bigIntValue;
|
|
295
295
|
} catch (e) {
|
package/package.json
CHANGED
package/unit.cjs
CHANGED
|
@@ -251,9 +251,9 @@ var unitToPlanck = (val, units) => {
|
|
|
251
251
|
const [integerPart, fractionalPart = ""] = strVal.split(".");
|
|
252
252
|
let bigIntValue = BigInt(integerPart) * BigInt(10) ** BigInt(units);
|
|
253
253
|
if (fractionalPart) {
|
|
254
|
-
const
|
|
255
|
-
const fractionalValue = BigInt(
|
|
256
|
-
bigIntValue += fractionalValue
|
|
254
|
+
const paddedFractional = fractionalPart.padEnd(units, "0");
|
|
255
|
+
const fractionalValue = BigInt(paddedFractional);
|
|
256
|
+
bigIntValue += fractionalValue;
|
|
257
257
|
}
|
|
258
258
|
return bigIntValue;
|
|
259
259
|
} catch (e) {
|
package/unit.js
CHANGED
|
@@ -194,9 +194,9 @@ var unitToPlanck = (val, units) => {
|
|
|
194
194
|
const [integerPart, fractionalPart = ""] = strVal.split(".");
|
|
195
195
|
let bigIntValue = BigInt(integerPart) * BigInt(10) ** BigInt(units);
|
|
196
196
|
if (fractionalPart) {
|
|
197
|
-
const
|
|
198
|
-
const fractionalValue = BigInt(
|
|
199
|
-
bigIntValue += fractionalValue
|
|
197
|
+
const paddedFractional = fractionalPart.padEnd(units, "0");
|
|
198
|
+
const fractionalValue = BigInt(paddedFractional);
|
|
199
|
+
bigIntValue += fractionalValue;
|
|
200
200
|
}
|
|
201
201
|
return bigIntValue;
|
|
202
202
|
} catch (e) {
|