@oh-my-pi/pi-utils 18.4.3 → 18.4.4
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/CHANGELOG.md +6 -0
- package/dist/types/format.d.ts +2 -0
- package/package.json +2 -2
- package/src/format.ts +5 -0
package/CHANGELOG.md
CHANGED
package/dist/types/format.d.ts
CHANGED
|
@@ -42,3 +42,5 @@ export declare function pluralize(label: string, count: number): string;
|
|
|
42
42
|
* Format a ratio as a percentage.
|
|
43
43
|
*/
|
|
44
44
|
export declare function formatPercent(ratio: number): string;
|
|
45
|
+
/** Round premium-request counters without losing legitimate fractional requests. */
|
|
46
|
+
export declare function normalizePremiumRequests(value: number): number;
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@oh-my-pi/pi-utils",
|
|
3
|
-
"version": "18.4.
|
|
3
|
+
"version": "18.4.4",
|
|
4
4
|
"description": "Shared utilities for pi packages",
|
|
5
5
|
"keywords": [
|
|
6
6
|
"cli",
|
|
@@ -57,7 +57,7 @@
|
|
|
57
57
|
"fmt": "oxfmt --no-error-on-unmatched-pattern 'src/**/*.{ts,tsx}' '{test,bench,examples,scripts}/**/*.ts' '*.ts'"
|
|
58
58
|
},
|
|
59
59
|
"dependencies": {
|
|
60
|
-
"@oh-my-pi/pi-natives": "18.4.
|
|
60
|
+
"@oh-my-pi/pi-natives": "18.4.4"
|
|
61
61
|
},
|
|
62
62
|
"devDependencies": {
|
|
63
63
|
"@types/bun": "^1.3.14"
|
package/src/format.ts
CHANGED
|
@@ -127,3 +127,8 @@ export function pluralize(label: string, count: number): string {
|
|
|
127
127
|
export function formatPercent(ratio: number): string {
|
|
128
128
|
return `${(ratio * 100).toFixed(1)}%`;
|
|
129
129
|
}
|
|
130
|
+
|
|
131
|
+
/** Round premium-request counters without losing legitimate fractional requests. */
|
|
132
|
+
export function normalizePremiumRequests(value: number): number {
|
|
133
|
+
return Math.round((value + Number.EPSILON) * 100) / 100;
|
|
134
|
+
}
|