@1delta/margin-fetcher 0.0.413 → 0.0.414
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.d.ts +15 -0
- package/dist/index.js +3 -2
- package/dist/index.js.map +1 -1
- package/package.json +6 -6
package/dist/index.d.ts
CHANGED
|
@@ -9240,6 +9240,21 @@ declare function findingsFor(sheet: TermSheet, side: 'supply' | 'borrow'): Sever
|
|
|
9240
9240
|
declare function hasCritical(sheet: TermSheet, side: 'supply' | 'borrow'): boolean;
|
|
9241
9241
|
|
|
9242
9242
|
/** `4.1234` → `"4.12 %"`; trims to 2dp, drops a trailing `.00`. */
|
|
9243
|
+
/**
|
|
9244
|
+
* Format an already-PERCENT value (`49.88` → `"49.88%"`).
|
|
9245
|
+
*
|
|
9246
|
+
* Never pass a fraction. The convention across the term sheet is **rates are
|
|
9247
|
+
* percent, factors/ratios are fractions**, so `liquidationLtv`, `penalty`,
|
|
9248
|
+
* `utilization` and every `*Ratio` must be multiplied by 100 at the call site.
|
|
9249
|
+
*
|
|
9250
|
+
* Trailing zeros are trimmed only inside the FRACTIONAL part: a naive
|
|
9251
|
+
* `/\.?0+$/` strip eats integer zeros whenever `dp = 0` leaves no decimal
|
|
9252
|
+
* point, turning `100` into `"1"` and `1000` into `"1"`.
|
|
9253
|
+
*
|
|
9254
|
+
* No space before the `%` — the portal formats the same numbers without one,
|
|
9255
|
+
* and a headline reading "49.88 %" next to a table cell reading "49.88%" looks
|
|
9256
|
+
* like two different figures.
|
|
9257
|
+
*/
|
|
9243
9258
|
declare function pct(value: number | undefined, dp?: number): string;
|
|
9244
9259
|
/** Duration in seconds → the coarsest human unit that stays honest. */
|
|
9245
9260
|
declare function duration(secs: number | undefined): string;
|
package/dist/index.js
CHANGED
|
@@ -62242,8 +62242,9 @@ function deriveBorrowTags(borrow, market = {}) {
|
|
|
62242
62242
|
var SECS_PER_DAY = 86400;
|
|
62243
62243
|
function pct(value, dp = 2) {
|
|
62244
62244
|
if (value == null || !Number.isFinite(value)) return "\u2014";
|
|
62245
|
-
const
|
|
62246
|
-
|
|
62245
|
+
const fixed = value.toFixed(dp);
|
|
62246
|
+
const trimmed = fixed.includes(".") ? fixed.replace(/0+$/, "").replace(/\.$/, "") : fixed;
|
|
62247
|
+
return `${trimmed === "" || trimmed === "-" ? "0" : trimmed}%`;
|
|
62247
62248
|
}
|
|
62248
62249
|
function duration(secs) {
|
|
62249
62250
|
if (secs == null || !Number.isFinite(secs) || secs < 0) return "\u2014";
|