apiblaze 0.17.4 → 0.17.6
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/dist/index.js +7 -4
- package/package.json +1 -1
package/dist/index.js
CHANGED
|
@@ -440,12 +440,15 @@ async function admin(call) {
|
|
|
440
440
|
}
|
|
441
441
|
return data;
|
|
442
442
|
}
|
|
443
|
+
function usdStr(cents) {
|
|
444
|
+
const wholeCents = Math.abs(cents - Math.round(cents)) < 1e-9;
|
|
445
|
+
return (cents / 100).toFixed(wholeCents ? 2 : 4);
|
|
446
|
+
}
|
|
443
447
|
function formatBilling(billing) {
|
|
444
448
|
const b = billing;
|
|
445
449
|
if (!b || typeof b.charged_cents !== "number") return null;
|
|
446
|
-
const
|
|
447
|
-
|
|
448
|
-
return `\u{1F4B3} Charged $${usd}${rem}`;
|
|
450
|
+
const rem = typeof b.credits_remaining === "number" ? ` \xB7 $${usdStr(b.credits_remaining)} credit left` : "";
|
|
451
|
+
return `\u{1F4B3} Charged $${usdStr(b.charged_cents)}${rem}`;
|
|
449
452
|
}
|
|
450
453
|
function maybePrintBilling(data) {
|
|
451
454
|
const line = formatBilling(data?.billing);
|
|
@@ -693,7 +696,7 @@ var import_commander = require("commander");
|
|
|
693
696
|
var import_chalk35 = __toESM(require("chalk"));
|
|
694
697
|
|
|
695
698
|
// package.json
|
|
696
|
-
var version = "0.17.
|
|
699
|
+
var version = "0.17.6";
|
|
697
700
|
|
|
698
701
|
// src/index.ts
|
|
699
702
|
init_types();
|
package/package.json
CHANGED