You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Copy file name to clipboardExpand all lines: index.d.ts
+8-4Lines changed: 8 additions & 4 deletions
Original file line number
Diff line number
Diff line change
@@ -52,10 +52,12 @@ export type Options = {
52
52
/**
53
53
The minimum number of fraction digits to display.
54
54
55
-
If neither `minimumFractionDigits` or `maximumFractionDigits` are set, the default behavior is to round to 3 significant digits.
56
-
57
55
@default undefined
58
56
57
+
If neither `minimumFractionDigits` nor `maximumFractionDigits` is set, the default behavior is to round to 3 significant digits.
58
+
59
+
Note: When `minimumFractionDigits` or `maximumFractionDigits` is specified, values are truncated instead of rounded to provide more intuitive results for file sizes.
60
+
59
61
@example
60
62
```
61
63
import prettyBytes from 'pretty-bytes';
@@ -73,10 +75,12 @@ export type Options = {
73
75
/**
74
76
The maximum number of fraction digits to display.
75
77
76
-
If neither `minimumFractionDigits` or `maximumFractionDigits` are set, the default behavior is to round to 3 significant digits.
77
-
78
78
@default undefined
79
79
80
+
If neither `minimumFractionDigits` nor `maximumFractionDigits` is set, the default behavior is to round to 3 significant digits.
81
+
82
+
Note: When `minimumFractionDigits` or `maximumFractionDigits` is specified, values are truncated instead of rounded to provide more intuitive results for file sizes.
Copy file name to clipboardExpand all lines: readme.md
+10-3Lines changed: 10 additions & 3 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -77,7 +77,8 @@ Format the number using the [Binary Prefix](https://en.wikipedia.org/wiki/Binary
77
77
Type: `boolean | string`\
78
78
Default: `false`*(No localization)*
79
79
80
-
**Important:** Only the number and decimal separator are localized. The unit title is not and will not be localized.
80
+
> [!IMPORTANT]
81
+
> Only the number and decimal separator are localized. The unit title is not and will not be localized.
81
82
82
83
- If `true`: Localize the output using the system/browser locale.
83
84
- If `string`: Expects a [BCP 47 language tag](https://en.wikipedia.org/wiki/IETF_language_tag) (For example: `en`, `de`, …)
@@ -90,7 +91,10 @@ Default: `undefined`
90
91
91
92
The minimum number of fraction digits to display.
92
93
93
-
If neither `minimumFractionDigits` or `maximumFractionDigits` are set, the default behavior is to round to 3 significant digits.
94
+
If neither `minimumFractionDigits` nor `maximumFractionDigits` is set, the default behavior is to round to 3 significant digits.
95
+
96
+
> [!NOTE]
97
+
> When `minimumFractionDigits` or `maximumFractionDigits` is specified, values are truncated instead of rounded to provide more intuitive results for file sizes.
94
98
95
99
```js
96
100
importprettyBytesfrom'pretty-bytes';
@@ -110,7 +114,10 @@ Default: `undefined`
110
114
111
115
The maximum number of fraction digits to display.
112
116
113
-
If neither `minimumFractionDigits` or `maximumFractionDigits` are set, the default behavior is to round to 3 significant digits.
117
+
If neither `minimumFractionDigits` nor `maximumFractionDigits` is set, the default behavior is to round to 3 significant digits.
118
+
119
+
> [!NOTE]
120
+
> When `minimumFractionDigits` or `maximumFractionDigits` is specified, values are truncated instead of rounded to provide more intuitive results for file sizes.
0 commit comments