@cloudflare/util-formatters
Advanced tools
Comparing version 2.4.6 to 2.4.7
@@ -6,2 +6,10 @@ # Change Log | ||
## [2.4.7](http://stash.cfops.it:7999/fe/stratus/compare/@cloudflare/util-formatters@2.4.6...@cloudflare/util-formatters@2.4.7) (2020-01-13) | ||
**Note:** Version bump only for package @cloudflare/util-formatters | ||
## [2.4.6](http://stash.cfops.it:7999/fe/stratus/compare/@cloudflare/util-formatters@2.4.4...@cloudflare/util-formatters@2.4.6) (2019-12-17) | ||
@@ -8,0 +16,0 @@ |
@@ -53,2 +53,10 @@ import { ESupportedLocales } from '@cloudflare/intl-core'; | ||
* @param {String} locale | ||
* @param {Boolean} [includeDecimals] | ||
* @param {Boolean} [useBit] | ||
* @return {String} | ||
*/ | ||
export declare const formatBits: (number: number, locale: ESupportedLocales | undefined, includeDecimals: boolean, useBit?: boolean) => string; | ||
/** | ||
* @param {Number} number | ||
* @param {String} locale | ||
* @param {Boolean} [useSI] | ||
@@ -55,0 +63,0 @@ * @param {Number} [decimalPlaces] |
@@ -143,2 +143,17 @@ import { format as d3Format } from 'd3-format'; | ||
* @param {String} locale | ||
* @param {Boolean} [includeDecimals] | ||
* @param {Boolean} [useBit] | ||
* @return {String} | ||
*/ | ||
export var formatBits = function formatBits(number) { | ||
var locale = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : DEFAULT_LOCALE; | ||
var includeDecimals = arguments.length > 2 ? arguments[2] : undefined; | ||
var useBit = arguments.length > 3 && arguments[3] !== undefined ? arguments[3] : true; | ||
return formatNumber(number, locale, true, includeDecimals ? 2 : 0) // Add space between value and SI unit | ||
.replace(/([a-zA-Z]?)$/, ' $1') + "".concat(useBit ? 'bit' : 'b'); | ||
}; | ||
/** | ||
* @param {Number} number | ||
* @param {String} locale | ||
* @param {Boolean} [useSI] | ||
@@ -145,0 +160,0 @@ * @param {Number} [decimalPlaces] |
@@ -1,2 +0,2 @@ | ||
import { formatNumberForAnalytics, formatBytes, formatNumber, formatDate, formatCurrency, localizeNumberWithPrecision, DateFormatters } from './formatters'; | ||
export { formatNumberForAnalytics, formatBytes, formatNumber, formatDate, formatCurrency, localizeNumberWithPrecision, DateFormatters }; | ||
import { formatNumberForAnalytics, formatBytes, formatBits, formatNumber, formatDate, formatCurrency, localizeNumberWithPrecision, DateFormatters } from './formatters'; | ||
export { formatNumberForAnalytics, formatBytes, formatBits, formatNumber, formatDate, formatCurrency, localizeNumberWithPrecision, DateFormatters }; |
@@ -6,3 +6,3 @@ "use strict"; | ||
}); | ||
exports.formatNumberForAnalytics = exports.formatBytes = exports.formatCurrency = exports.formatNumber = exports.localizeNumberWithPrecision = exports.formatDate = exports.DateFormatters = void 0; | ||
exports.formatNumberForAnalytics = exports.formatBits = exports.formatBytes = exports.formatCurrency = exports.formatNumber = exports.localizeNumberWithPrecision = exports.formatDate = exports.DateFormatters = void 0; | ||
@@ -169,2 +169,20 @@ var _d3Format = require("d3-format"); | ||
* @param {String} locale | ||
* @param {Boolean} [includeDecimals] | ||
* @param {Boolean} [useBit] | ||
* @return {String} | ||
*/ | ||
exports.formatBytes = formatBytes; | ||
var formatBits = function formatBits(number) { | ||
var locale = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : DEFAULT_LOCALE; | ||
var includeDecimals = arguments.length > 2 ? arguments[2] : undefined; | ||
var useBit = arguments.length > 3 && arguments[3] !== undefined ? arguments[3] : true; | ||
return formatNumber(number, locale, true, includeDecimals ? 2 : 0) // Add space between value and SI unit | ||
.replace(/([a-zA-Z]?)$/, ' $1') + "".concat(useBit ? 'bit' : 'b'); | ||
}; | ||
/** | ||
* @param {Number} number | ||
* @param {String} locale | ||
* @param {Boolean} [useSI] | ||
@@ -177,3 +195,3 @@ * @param {Number} [decimalPlaces] | ||
exports.formatBytes = formatBytes; | ||
exports.formatBits = formatBits; | ||
@@ -180,0 +198,0 @@ var formatNumberForAnalytics = function formatNumberForAnalytics(number) { |
@@ -18,2 +18,8 @@ "use strict"; | ||
}); | ||
Object.defineProperty(exports, "formatBits", { | ||
enumerable: true, | ||
get: function get() { | ||
return _formatters.formatBits; | ||
} | ||
}); | ||
Object.defineProperty(exports, "formatNumber", { | ||
@@ -20,0 +26,0 @@ enumerable: true, |
{ | ||
"name": "@cloudflare/util-formatters", | ||
"description": "", | ||
"version": "2.4.6", | ||
"version": "2.4.7", | ||
"types": "./dist/index.d.ts", | ||
@@ -25,3 +25,3 @@ "main": "lib/index.js", | ||
}, | ||
"gitHead": "0e0e4fc58fbd1d2c888bad3336101d800e747c7d" | ||
"gitHead": "d579ed8cf46b8fefbe92ff2c516b7702b696bffb" | ||
} |
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
23569
447