@automattic/number-formatters 1.0.18 → 1.1.0
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
CHANGED
|
@@ -4,6 +4,10 @@ All notable changes to this project will be documented in this file.
|
|
|
4
4
|
|
|
5
5
|
The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/).
|
|
6
6
|
|
|
7
|
+
## [1.1.0] - 2026-02-23
|
|
8
|
+
### Added
|
|
9
|
+
- `getCurrencyObject`: Add `floatValue` property to currency object. [#47203]
|
|
10
|
+
|
|
7
11
|
## [1.0.18] - 2026-02-18
|
|
8
12
|
### Changed
|
|
9
13
|
- Set `.repository.url` in `package.json` to the mirror repo rather than the monorepo. [#47149]
|
|
@@ -105,6 +109,7 @@ The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/).
|
|
|
105
109
|
- Initial release
|
|
106
110
|
- Basic number formatting functionality
|
|
107
111
|
|
|
112
|
+
[1.1.0]: https://github.com/Automattic/number-formatters/compare/1.0.18...1.1.0
|
|
108
113
|
[1.0.18]: https://github.com/Automattic/number-formatters/compare/1.0.17...1.0.18
|
|
109
114
|
[1.0.17]: https://github.com/Automattic/number-formatters/compare/1.0.16...1.0.17
|
|
110
115
|
[1.0.16]: https://github.com/Automattic/number-formatters/compare/1.0.15...1.0.16
|
package/dist/types/types.d.ts
CHANGED
|
@@ -103,6 +103,16 @@ export interface CurrencyObject {
|
|
|
103
103
|
* True if the formatted number has a non-0 decimal part.
|
|
104
104
|
*/
|
|
105
105
|
hasNonZeroFraction: boolean;
|
|
106
|
+
/**
|
|
107
|
+
* The raw floating-point version of the number prepared for formatting,
|
|
108
|
+
* after unit conversion and precision scaling.
|
|
109
|
+
*
|
|
110
|
+
* For non-decimal currencies (eg: JPY) this will actually be an integer.
|
|
111
|
+
* Otherwise it will likely be a floating-point number. Be careful with this!
|
|
112
|
+
* It should not be used for math if possible because of floating-point
|
|
113
|
+
* rounding issues! Use the smallest unit instead.
|
|
114
|
+
*/
|
|
115
|
+
floatValue: number;
|
|
106
116
|
}
|
|
107
117
|
export type FormatNumber = (number: number, options?: Omit<NumberFormatParams, 'browserSafeLocale'>) => string;
|
|
108
118
|
export type FormatCurrency = (number: number, currency: string, options?: Omit<NumberFormatCurrencyParams, 'number' | 'currency' | 'browserSafeLocale' | 'geoLocation'>) => string;
|
package/package.json
CHANGED
package/src/types.ts
CHANGED
|
@@ -118,6 +118,17 @@ export interface CurrencyObject {
|
|
|
118
118
|
* True if the formatted number has a non-0 decimal part.
|
|
119
119
|
*/
|
|
120
120
|
hasNonZeroFraction: boolean;
|
|
121
|
+
|
|
122
|
+
/**
|
|
123
|
+
* The raw floating-point version of the number prepared for formatting,
|
|
124
|
+
* after unit conversion and precision scaling.
|
|
125
|
+
*
|
|
126
|
+
* For non-decimal currencies (eg: JPY) this will actually be an integer.
|
|
127
|
+
* Otherwise it will likely be a floating-point number. Be careful with this!
|
|
128
|
+
* It should not be used for math if possible because of floating-point
|
|
129
|
+
* rounding issues! Use the smallest unit instead.
|
|
130
|
+
*/
|
|
131
|
+
floatValue: number;
|
|
121
132
|
}
|
|
122
133
|
|
|
123
134
|
export type FormatNumber = (
|