@cloudflare/util-formatters 2.7.2 → 2.7.3

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
@@ -3,6 +3,14 @@
3
3
  All notable changes to this project will be documented in this file.
4
4
  See [Conventional Commits](https://conventionalcommits.org) for commit guidelines.
5
5
 
6
+ ## [2.7.3](http://stash.cfops.it:7999/fe/stratus/compare/@cloudflare/util-formatters@2.7.2...@cloudflare/util-formatters@2.7.3) (2022-04-12)
7
+
8
+ **Note:** Version bump only for package @cloudflare/util-formatters
9
+
10
+
11
+
12
+
13
+
6
14
  ## [2.7.2](http://stash.cfops.it:7999/fe/stratus/compare/@cloudflare/util-formatters@2.7.1...@cloudflare/util-formatters@2.7.2) (2022-02-14)
7
15
 
8
16
  **Note:** Version bump only for package @cloudflare/util-formatters
@@ -48,7 +48,7 @@ export declare const formatCurrency: (value?: CurrencyValue, options?: CurrencyO
48
48
  * @param {Boolean} [includeDecimals]
49
49
  * @return {String}
50
50
  */
51
- export declare const formatBytes: (number: number, locale: SupportedLocales | undefined, includeDecimals: boolean) => string;
51
+ export declare const formatBytes: (number: number, locale: SupportedLocales | undefined, includeDecimals: boolean, useBytes?: boolean) => string;
52
52
  /**
53
53
  * @param {Number} number
54
54
  * @param {String} locale
package/es/formatters.js CHANGED
@@ -135,9 +135,9 @@ export const formatCurrency = (value = 0, options = {
135
135
  * @return {String}
136
136
  */
137
137
 
138
- export const formatBytes = (number, locale = DEFAULT_LOCALE, includeDecimals) => {
138
+ export const formatBytes = (number, locale = DEFAULT_LOCALE, includeDecimals, useBytes = false) => {
139
139
  return formatNumber(number, locale, 'si', includeDecimals ? 2 : 0) // Add space between value and SI unit
140
- .replace(/([a-zA-Z]?)$/, ' $1') + 'B';
140
+ .replace(/([a-zA-Z]?)$/, ' $1') + `${useBytes ? 'Bytes' : 'B'}`;
141
141
  };
142
142
  /**
143
143
  * @param {Number} number
package/lib/formatters.js CHANGED
@@ -174,8 +174,9 @@ exports.formatCurrency = formatCurrency;
174
174
  var formatBytes = function formatBytes(number) {
175
175
  var locale = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : DEFAULT_LOCALE;
176
176
  var includeDecimals = arguments.length > 2 ? arguments[2] : undefined;
177
+ var useBytes = arguments.length > 3 && arguments[3] !== undefined ? arguments[3] : false;
177
178
  return formatNumber(number, locale, 'si', includeDecimals ? 2 : 0) // Add space between value and SI unit
178
- .replace(/([a-zA-Z]?)$/, ' $1') + 'B';
179
+ .replace(/([a-zA-Z]?)$/, ' $1') + "".concat(useBytes ? 'Bytes' : 'B');
179
180
  };
180
181
  /**
181
182
  * @param {Number} number
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "@cloudflare/util-formatters",
3
3
  "description": "",
4
- "version": "2.7.2",
4
+ "version": "2.7.3",
5
5
  "types": "./dist/index.d.ts",
6
6
  "main": "lib/index.js",
7
7
  "module": "es/index.js",
@@ -21,5 +21,5 @@
21
21
  "d3-format": "^1.3.2",
22
22
  "moment": "^2.29.1"
23
23
  },
24
- "gitHead": "e291d1ce7d364a3bdc62b63aaf17a0164e3abce0"
24
+ "gitHead": "16064397a5d5f2cf70fbbb5ced5c176604397439"
25
25
  }