Socket
Socket
Sign inDemoInstall

@formatjs/intl-unified-numberformat

Package Overview
Dependencies
Maintainers
2
Versions
43
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

Comparing version 0.4.5 to 0.4.6

8

CHANGELOG.md

@@ -6,2 +6,10 @@ # Change Log

## [0.4.6](https://github.com/formatjs/formatjs/compare/@formatjs/intl-unified-numberformat@0.4.5...@formatjs/intl-unified-numberformat@0.4.6) (2019-08-29)
**Note:** Version bump only for package @formatjs/intl-unified-numberformat
## [0.4.5](https://github.com/formatjs/formatjs/compare/@formatjs/intl-unified-numberformat@0.4.4...@formatjs/intl-unified-numberformat@0.4.5) (2019-08-30)

@@ -8,0 +16,0 @@

6

dist/core.js

@@ -18,4 +18,6 @@ "use strict";

if (s != null && typeof Object.getOwnPropertySymbols === "function")
for (var i = 0, p = Object.getOwnPropertySymbols(s); i < p.length; i++) if (e.indexOf(p[i]) < 0)
t[p[i]] = s[p[i]];
for (var i = 0, p = Object.getOwnPropertySymbols(s); i < p.length; i++) {
if (e.indexOf(p[i]) < 0 && Object.prototype.propertyIsEnumerable.call(s, p[i]))
t[p[i]] = s[p[i]];
}
return t;

@@ -22,0 +24,0 @@ };

(function (global, factory) {
typeof exports === 'object' && typeof module !== 'undefined' ? factory(exports) :
typeof define === 'function' && define.amd ? define(['exports'], factory) :
(global = global || self, factory(global.IntlUnifiedNumberFormat = {}));
typeof exports === 'object' && typeof module !== 'undefined' ? factory(exports) :
typeof define === 'function' && define.amd ? define(['exports'], factory) :
(global = global || self, factory(global.IntlUnifiedNumberFormat = {}));
}(this, function (exports) { 'use strict';
/**
* @name toDate
* @category Common Helpers
* @summary Convert the given argument to an instance of Date.
*
* @description
* Convert the given argument to an instance of Date.
*
* If the argument is an instance of Date, the function returns its clone.
*
* If the argument is a number, it is treated as a timestamp.
*
* If the argument is none of the above, the function returns Invalid Date.
*
* **Note**: *all* Date arguments passed to any *date-fns* function is processed by `toDate`.
*
* @param {Date|Number} argument - the value to convert
* @returns {Date} the parsed date in the local time zone
* @throws {TypeError} 1 argument required
*
* @example
* // Clone the date:
* const result = toDate(new Date(2014, 1, 11, 11, 30, 30))
* //=> Tue Feb 11 2014 11:30:30
*
* @example
* // Convert the timestamp to date:
* const result = toDate(1392098430000)
* //=> Tue Feb 11 2014 11:30:30
*/
var __assign = (undefined && undefined.__assign) || function () {
__assign = Object.assign || function(t) {
for (var s, i = 1, n = arguments.length; i < n; i++) {
s = arguments[i];
for (var p in s) if (Object.prototype.hasOwnProperty.call(s, p))
t[p] = s[p];
}
return t;
};
return __assign.apply(this, arguments);
};
/**
* @name endOfTomorrow
* @category Day Helpers
* @summary Return the end of tomorrow.
* @pure false
*
* @description
* Return the end of tomorrow.
*
* > ⚠️ Please note that this function is not present in the FP submodule as
* > it uses `Date.now()` internally hence impure and can't be safely curried.
*
* ### v2.0.0 breaking changes:
*
* - [Changes that are common for the whole library](https://github.com/date-fns/date-fns/blob/master/docs/upgradeGuide.md#Common-Changes).
*
* @returns {Date} the end of tomorrow
*
* @example
* // If today is 6 October 2014:
* var result = endOfTomorrow()
* //=> Tue Oct 7 2014 23:59:59.999
*/
function resolveSupportedLocales(locales, localeData, aliases) {
if (aliases === void 0) { aliases = {}; }
var resolvedLocales = (Array.isArray(locales) ? locales : [locales])
.filter(function (s) { return typeof s === 'string'; })
.map(function (l) { return aliases[l] || l; });
var i, len, localeParts, data;
var supportedLocales = [];
// Using the set of locales + the default locale, we look for the first one
// which that has been registered. When data does not exist for a locale, we
// traverse its ancestors to find something that's been registered within
// its hierarchy of locales. Since we lack the proper `parentLocale` data
// here, we must take a naive approach to traversal.
for (i = 0, len = resolvedLocales.length; i < len; i += 1) {
localeParts = resolvedLocales[i].toLowerCase().split('-');
while (localeParts.length) {
if (localeData) {
data = localeData[localeParts.join('-')];
if (data) {
// Return the normalized locale string; e.g., we return "en-US",
// instead of "en-us".
supportedLocales.push(data.locale);
break;
}
localeParts.pop();
}
}
}
return supportedLocales;
}
/**
* @name endOfYesterday
* @category Day Helpers
* @summary Return the end of yesterday.
* @pure false
*
* @description
* Return the end of yesterday.
*
* > ⚠️ Please note that this function is not present in the FP submodule as
* > it uses `Date.now()` internally hence impure and can't be safely curried.
*
* ### v2.0.0 breaking changes:
*
* - [Changes that are common for the whole library](https://github.com/date-fns/date-fns/blob/master/docs/upgradeGuide.md#Common-Changes).
*
* @returns {Date} the end of yesterday
*
* @example
* // If today is 6 October 2014:
* var result = endOfYesterday()
* //=> Sun Oct 5 2014 23:59:59.999
*/
var __assign$1 = (undefined && undefined.__assign) || function () {
__assign$1 = Object.assign || function(t) {
for (var s, i = 1, n = arguments.length; i < n; i++) {
s = arguments[i];
for (var p in s) if (Object.prototype.hasOwnProperty.call(s, p))
t[p] = s[p];
}
return t;
};
return __assign$1.apply(this, arguments);
};
var __rest = (undefined && undefined.__rest) || function (s, e) {
var t = {};
for (var p in s) if (Object.prototype.hasOwnProperty.call(s, p) && e.indexOf(p) < 0)
t[p] = s[p];
if (s != null && typeof Object.getOwnPropertySymbols === "function")
for (var i = 0, p = Object.getOwnPropertySymbols(s); i < p.length; i++) {
if (e.indexOf(p[i]) < 0 && Object.prototype.propertyIsEnumerable.call(s, p[i]))
t[p[i]] = s[p[i]];
}
return t;
};
function isUnitSupported(unit) {
try {
new Intl.NumberFormat(undefined, {
style: 'unit',
unit: unit,
});
}
catch (e) {
return false;
}
return true;
}
var NativeNumberFormat = Intl.NumberFormat;
function findUnitData(locale, unit) {
var data = UnifiedNumberFormat.__unitLocaleData__;
var parentLocale = '';
locale = locale.toLowerCase();
if (!data[locale]) {
parentLocale = locale.split('-')[0];
}
else {
if (data[locale].units[unit]) {
return data[locale].units[unit];
}
if (data[locale].parentLocale) {
parentLocale = data[locale].parentLocale;
}
else {
throw new RangeError("Cannot find data for " + locale);
}
}
return findUnitData(parentLocale, unit);
}
function intersection(arr1, arr2) {
return arr1.filter(function (s) { return ~arr2.indexOf(s); });
}
var DEFAULT_LOCALE = new NativeNumberFormat().resolvedOptions().locale;
var UnifiedNumberFormat = /** @class */ (function () {
function UnifiedNumberFormat(locales, _a) {
if (_a === void 0) { _a = {}; }
var style = _a.style, unit = _a.unit, unitDisplay = _a.unitDisplay, options = __rest(_a, ["style", "unit", "unitDisplay"]);
this.unit = undefined;
this.unitDisplay = undefined;
if (style === 'unit') {
if (!unit) {
throw new TypeError('Unit is required for `style: unit`');
}
this.unit = unit;
this.unitDisplay = unitDisplay || 'short';
var resolvedLocale = resolveSupportedLocales(intersection(NativeNumberFormat.supportedLocalesOf(locales), Intl.PluralRules.supportedLocalesOf(locales)).concat([
DEFAULT_LOCALE,
]), UnifiedNumberFormat.__unitLocaleData__)[0];
this.patternData = findUnitData(resolvedLocale, this.unit);
}
this.nf = new NativeNumberFormat(locales, __assign$1({}, options, { style: style === 'unit' ? 'decimal' : style }));
this.locale = this.nf.resolvedOptions().locale;
}
UnifiedNumberFormat.prototype.format = function (num) {
var formattedNum = this.nf.format(num);
if (this.patternData) {
var pl = new Intl.PluralRules(this.locale).select(num);
var pattern = this.patternData[this.unitDisplay][pl === 'one' ? 'one' : 'other'];
return pattern.replace('{0}', formattedNum);
}
return formattedNum;
};
UnifiedNumberFormat.prototype.formatToParts = function (num) {
return this.nf.formatToParts(num);
};
UnifiedNumberFormat.prototype.resolvedOptions = function () {
var ro = this.nf.resolvedOptions();
if (this.unit) {
ro.style = 'unit';
ro.unit = this.unit;
ro.unitDisplay = this.unitDisplay;
}
return ro;
};
UnifiedNumberFormat.supportedLocalesOf = function () {
var args = [];
for (var _i = 0; _i < arguments.length; _i++) {
args[_i] = arguments[_i];
}
return resolveSupportedLocales(args[0], UnifiedNumberFormat.__unitLocaleData__);
};
UnifiedNumberFormat.__addUnitLocaleData = function (data) {
Object.keys(data).forEach(function (locale) {
var datum = data[locale];
if (!(datum && datum.locale)) {
throw new Error('Locale data provided to UnifiedNumberFormat is missing a ' +
'`locale` property value');
}
UnifiedNumberFormat.__unitLocaleData__[datum.locale.toLowerCase()] = datum;
});
};
UnifiedNumberFormat.polyfilled = true;
UnifiedNumberFormat.__unitLocaleData__ = {};
return UnifiedNumberFormat;
}());
/**
* @name isDate
* @category Common Helpers
* @summary Is the given value a date?
*
* @description
* Returns true if the given value is an instance of Date. The function works for dates transferred across iframes.
*
* ### v2.0.0 breaking changes:
*
* - [Changes that are common for the whole library](https://github.com/date-fns/date-fns/blob/master/docs/upgradeGuide.md#Common-Changes).
*
* @param {*} value - the value to check
* @returns {boolean} true if the given value is a date
* @throws {TypeError} 1 arguments required
*
* @example
* // For a valid date:
* var result = isDate(new Date())
* //=> true
*
* @example
* // For an invalid date:
* var result = isDate(new Date(NaN))
* //=> true
*
* @example
* // For some value:
* var result = isDate('2014-02-31')
* //=> false
*
* @example
* // For an object:
* var result = isDate({})
* //=> false
*/
exports.UnifiedNumberFormat = UnifiedNumberFormat;
exports.isUnitSupported = isUnitSupported;
/**
* @name startOfTomorrow
* @category Day Helpers
* @summary Return the start of tomorrow.
* @pure false
*
* @description
* Return the start of tomorrow.
*
* > ⚠️ Please note that this function is not present in the FP submodule as
* > it uses `Date.now()` internally hence impure and can't be safely curried.
*
* ### v2.0.0 breaking changes:
*
* - [Changes that are common for the whole library](https://github.com/date-fns/date-fns/blob/master/docs/upgradeGuide.md#Common-Changes).
*
* @returns {Date} the start of tomorrow
*
* @example
* // If today is 6 October 2014:
* var result = startOfTomorrow()
* //=> Tue Oct 7 2014 00:00:00
*/
Object.defineProperty(exports, '__esModule', { value: true });
/**
* @name startOfYesterday
* @category Day Helpers
* @summary Return the start of yesterday.
* @pure false
*
* @description
* Return the start of yesterday.
*
* > ⚠️ Please note that this function is not present in the FP submodule as
* > it uses `Date.now()` internally hence impure and can't be safely curried.
*
* ### v2.0.0 breaking changes:
*
* - [Changes that are common for the whole library](https://github.com/date-fns/date-fns/blob/master/docs/upgradeGuide.md#Common-Changes).
*
* @returns {Date} the start of yesterday
*
* @example
* // If today is 6 October 2014:
* var result = startOfYesterday()
* //=> Sun Oct 5 2014 00:00:00
*/
/**
* Maximum allowed time.
* @constant
* @type {number}
* @default
*/
// This file is generated automatically by `scripts/build/indices.js`. Please, don't change it.
var __assign = (undefined && undefined.__assign) || function () {
__assign = Object.assign || function(t) {
for (var s, i = 1, n = arguments.length; i < n; i++) {
s = arguments[i];
for (var p in s) if (Object.prototype.hasOwnProperty.call(s, p))
t[p] = s[p];
}
return t;
};
return __assign.apply(this, arguments);
};
function resolveSupportedLocales(locales, localeData, aliases) {
if (aliases === void 0) { aliases = {}; }
var resolvedLocales = (Array.isArray(locales) ? locales : [locales])
.filter(function (s) { return typeof s === 'string'; })
.map(function (l) { return aliases[l] || l; });
var i, len, localeParts, data;
var supportedLocales = [];
// Using the set of locales + the default locale, we look for the first one
// which that has been registered. When data does not exist for a locale, we
// traverse its ancestors to find something that's been registered within
// its hierarchy of locales. Since we lack the proper `parentLocale` data
// here, we must take a naive approach to traversal.
for (i = 0, len = resolvedLocales.length; i < len; i += 1) {
localeParts = resolvedLocales[i].toLowerCase().split('-');
while (localeParts.length) {
if (localeData) {
data = localeData[localeParts.join('-')];
if (data) {
// Return the normalized locale string; e.g., we return "en-US",
// instead of "en-us".
supportedLocales.push(data.locale);
break;
}
localeParts.pop();
}
}
}
return supportedLocales;
}
var __assign$1 = (undefined && undefined.__assign) || function () {
__assign$1 = Object.assign || function(t) {
for (var s, i = 1, n = arguments.length; i < n; i++) {
s = arguments[i];
for (var p in s) if (Object.prototype.hasOwnProperty.call(s, p))
t[p] = s[p];
}
return t;
};
return __assign$1.apply(this, arguments);
};
var __rest = (undefined && undefined.__rest) || function (s, e) {
var t = {};
for (var p in s) if (Object.prototype.hasOwnProperty.call(s, p) && e.indexOf(p) < 0)
t[p] = s[p];
if (s != null && typeof Object.getOwnPropertySymbols === "function")
for (var i = 0, p = Object.getOwnPropertySymbols(s); i < p.length; i++) if (e.indexOf(p[i]) < 0)
t[p[i]] = s[p[i]];
return t;
};
function isUnitSupported(unit) {
try {
new Intl.NumberFormat(undefined, {
style: 'unit',
unit: unit,
});
}
catch (e) {
return false;
}
return true;
}
var NativeNumberFormat = Intl.NumberFormat;
function findUnitData(locale, unit) {
var data = UnifiedNumberFormat.__unitLocaleData__;
var parentLocale = '';
locale = locale.toLowerCase();
if (!data[locale]) {
parentLocale = locale.split('-')[0];
}
else {
if (data[locale].units[unit]) {
return data[locale].units[unit];
}
if (data[locale].parentLocale) {
parentLocale = data[locale].parentLocale;
}
else {
throw new RangeError("Cannot find data for " + locale);
}
}
return findUnitData(parentLocale, unit);
}
function intersection(arr1, arr2) {
return arr1.filter(function (s) { return ~arr2.indexOf(s); });
}
var DEFAULT_LOCALE = new NativeNumberFormat().resolvedOptions().locale;
var UnifiedNumberFormat = /** @class */ (function () {
function UnifiedNumberFormat(locales, _a) {
if (_a === void 0) { _a = {}; }
var style = _a.style, unit = _a.unit, unitDisplay = _a.unitDisplay, options = __rest(_a, ["style", "unit", "unitDisplay"]);
this.unit = undefined;
this.unitDisplay = undefined;
if (style === 'unit') {
if (!unit) {
throw new TypeError('Unit is required for `style: unit`');
}
this.unit = unit;
this.unitDisplay = unitDisplay || 'short';
var resolvedLocale = resolveSupportedLocales(intersection(NativeNumberFormat.supportedLocalesOf(locales), Intl.PluralRules.supportedLocalesOf(locales)).concat([
DEFAULT_LOCALE,
]), UnifiedNumberFormat.__unitLocaleData__)[0];
this.patternData = findUnitData(resolvedLocale, this.unit);
}
this.nf = new NativeNumberFormat(locales, __assign$1({}, options, { style: style === 'unit' ? 'decimal' : style }));
this.locale = this.nf.resolvedOptions().locale;
}
UnifiedNumberFormat.prototype.format = function (num) {
var formattedNum = this.nf.format(num);
if (this.patternData) {
var pl = new Intl.PluralRules(this.locale).select(num);
var pattern = this.patternData[this.unitDisplay][pl === 'one' ? 'one' : 'other'];
return pattern.replace('{0}', formattedNum);
}
return formattedNum;
};
UnifiedNumberFormat.prototype.formatToParts = function (num) {
return this.nf.formatToParts(num);
};
UnifiedNumberFormat.prototype.resolvedOptions = function () {
var ro = this.nf.resolvedOptions();
if (this.unit) {
ro.style = 'unit';
ro.unit = this.unit;
ro.unitDisplay = this.unitDisplay;
}
return ro;
};
UnifiedNumberFormat.supportedLocalesOf = function () {
var args = [];
for (var _i = 0; _i < arguments.length; _i++) {
args[_i] = arguments[_i];
}
return resolveSupportedLocales(args[0], UnifiedNumberFormat.__unitLocaleData__);
};
UnifiedNumberFormat.__addUnitLocaleData = function (data) {
Object.keys(data).forEach(function (locale) {
var datum = data[locale];
if (!(datum && datum.locale)) {
throw new Error('Locale data provided to UnifiedNumberFormat is missing a ' +
'`locale` property value');
}
UnifiedNumberFormat.__unitLocaleData__[datum.locale.toLowerCase()] = datum;
});
};
UnifiedNumberFormat.polyfilled = true;
UnifiedNumberFormat.__unitLocaleData__ = {};
return UnifiedNumberFormat;
}());
exports.UnifiedNumberFormat = UnifiedNumberFormat;
exports.isUnitSupported = isUnitSupported;
Object.defineProperty(exports, '__esModule', { value: true });
}));
//# sourceMappingURL=intl-unified-numberformat.js.map

@@ -1,2 +0,2 @@

!function(t,e){"object"==typeof exports&&"undefined"!=typeof module?e(exports):"function"==typeof define&&define.amd?define(["exports"],e):e((t=t||self).IntlUnifiedNumberFormat={})}(this,function(t){"use strict";function u(t,e,n){void 0===n&&(n={});var r,i,o,a,u=(Array.isArray(t)?t:[t]).filter(function(t){return"string"==typeof t}).map(function(t){return n[t]||t}),l=[];for(r=0,i=u.length;r<i;r+=1)for(o=u[r].toLowerCase().split("-");o.length;)if(e){if(a=e[o.join("-")]){l.push(a.locale);break}o.pop()}return l}var l=function(){return(l=Object.assign||function(t){for(var e,n=1,r=arguments.length;n<r;n++)for(var i in e=arguments[n])Object.prototype.hasOwnProperty.call(e,i)&&(t[i]=e[i]);return t}).apply(this,arguments)},s=function(t,e){var n={};for(var r in t)Object.prototype.hasOwnProperty.call(t,r)&&e.indexOf(r)<0&&(n[r]=t[r]);if(null!=t&&"function"==typeof Object.getOwnPropertySymbols){var i=0;for(r=Object.getOwnPropertySymbols(t);i<r.length;i++)e.indexOf(r[i])<0&&(n[r[i]]=t[r[i]])}return n};var f=Intl.NumberFormat;var p=(new f).resolvedOptions().locale,c=(d.prototype.format=function(t){var e=this.nf.format(t);if(this.patternData){var n=new Intl.PluralRules(this.locale).select(t);return this.patternData[this.unitDisplay]["one"===n?"one":"other"].replace("{0}",e)}return e},d.prototype.formatToParts=function(t){return this.nf.formatToParts(t)},d.prototype.resolvedOptions=function(){var t=this.nf.resolvedOptions();return this.unit&&(t.style="unit",t.unit=this.unit,t.unitDisplay=this.unitDisplay),t},d.supportedLocalesOf=function(){for(var t=[],e=0;e<arguments.length;e++)t[e]=arguments[e];return u(t[0],d.__unitLocaleData__)},d.__addUnitLocaleData=function(n){Object.keys(n).forEach(function(t){var e=n[t];if(!e||!e.locale)throw new Error("Locale data provided to UnifiedNumberFormat is missing a `locale` property value");d.__unitLocaleData__[e.locale.toLowerCase()]=e})},d.polyfilled=!0,d.__unitLocaleData__={},d);function d(t,e){void 0===e&&(e={});var n=e.style,r=e.unit,i=e.unitDisplay,o=s(e,["style","unit","unitDisplay"]);if(this.unit=void 0,this.unitDisplay=void 0,"unit"===n){if(!r)throw new TypeError("Unit is required for `style: unit`");this.unit=r,this.unitDisplay=i||"short";var a=u(function(t,e){return t.filter(function(t){return~e.indexOf(t)})}(f.supportedLocalesOf(t),Intl.PluralRules.supportedLocalesOf(t)).concat([p]),d.__unitLocaleData__)[0];this.patternData=function t(e,n){var r=c.__unitLocaleData__,i="";if(r[e=e.toLowerCase()]){if(r[e].units[n])return r[e].units[n];if(!r[e].parentLocale)throw new RangeError("Cannot find data for "+e);i=r[e].parentLocale}else i=e.split("-")[0];return t(i,n)}(a,this.unit)}this.nf=new f(t,l({},o,{style:"unit"===n?"decimal":n})),this.locale=this.nf.resolvedOptions().locale}t.UnifiedNumberFormat=c,t.isUnitSupported=function(t){try{new Intl.NumberFormat(void 0,{style:"unit",unit:t})}catch(t){return!1}return!0},Object.defineProperty(t,"__esModule",{value:!0})});
!function(t,e){"object"==typeof exports&&"undefined"!=typeof module?e(exports):"function"==typeof define&&define.amd?define(["exports"],e):e((t=t||self).IntlUnifiedNumberFormat={})}(this,function(t){"use strict";function l(t,e,n){void 0===n&&(n={});var r,i,o,a,l=(Array.isArray(t)?t:[t]).filter(function(t){return"string"==typeof t}).map(function(t){return n[t]||t}),u=[];for(r=0,i=l.length;r<i;r+=1)for(o=l[r].toLowerCase().split("-");o.length;)if(e){if(a=e[o.join("-")]){u.push(a.locale);break}o.pop()}return u}var u=function(){return(u=Object.assign||function(t){for(var e,n=1,r=arguments.length;n<r;n++)for(var i in e=arguments[n])Object.prototype.hasOwnProperty.call(e,i)&&(t[i]=e[i]);return t}).apply(this,arguments)},s=function(t,e){var n={};for(var r in t)Object.prototype.hasOwnProperty.call(t,r)&&e.indexOf(r)<0&&(n[r]=t[r]);if(null!=t&&"function"==typeof Object.getOwnPropertySymbols){var i=0;for(r=Object.getOwnPropertySymbols(t);i<r.length;i++)e.indexOf(r[i])<0&&Object.prototype.propertyIsEnumerable.call(t,r[i])&&(n[r[i]]=t[r[i]])}return n};var f=Intl.NumberFormat;var p=(new f).resolvedOptions().locale,c=(y.prototype.format=function(t){var e=this.nf.format(t);if(this.patternData){var n=new Intl.PluralRules(this.locale).select(t);return this.patternData[this.unitDisplay]["one"===n?"one":"other"].replace("{0}",e)}return e},y.prototype.formatToParts=function(t){return this.nf.formatToParts(t)},y.prototype.resolvedOptions=function(){var t=this.nf.resolvedOptions();return this.unit&&(t.style="unit",t.unit=this.unit,t.unitDisplay=this.unitDisplay),t},y.supportedLocalesOf=function(){for(var t=[],e=0;e<arguments.length;e++)t[e]=arguments[e];return l(t[0],y.__unitLocaleData__)},y.__addUnitLocaleData=function(n){Object.keys(n).forEach(function(t){var e=n[t];if(!e||!e.locale)throw new Error("Locale data provided to UnifiedNumberFormat is missing a `locale` property value");y.__unitLocaleData__[e.locale.toLowerCase()]=e})},y.polyfilled=!0,y.__unitLocaleData__={},y);function y(t,e){void 0===e&&(e={});var n=e.style,r=e.unit,i=e.unitDisplay,o=s(e,["style","unit","unitDisplay"]);if(this.unit=void 0,this.unitDisplay=void 0,"unit"===n){if(!r)throw new TypeError("Unit is required for `style: unit`");this.unit=r,this.unitDisplay=i||"short";var a=l(function(t,e){return t.filter(function(t){return~e.indexOf(t)})}(f.supportedLocalesOf(t),Intl.PluralRules.supportedLocalesOf(t)).concat([p]),y.__unitLocaleData__)[0];this.patternData=function t(e,n){var r=c.__unitLocaleData__,i="";if(r[e=e.toLowerCase()]){if(r[e].units[n])return r[e].units[n];if(!r[e].parentLocale)throw new RangeError("Cannot find data for "+e);i=r[e].parentLocale}else i=e.split("-")[0];return t(i,n)}(a,this.unit)}this.nf=new f(t,u({},o,{style:"unit"===n?"decimal":n})),this.locale=this.nf.resolvedOptions().locale}t.UnifiedNumberFormat=c,t.isUnitSupported=function(t){try{new Intl.NumberFormat(void 0,{style:"unit",unit:t})}catch(t){return!1}return!0},Object.defineProperty(t,"__esModule",{value:!0})});
//# sourceMappingURL=intl-unified-numberformat.min.js.map

@@ -17,4 +17,6 @@ var __assign = (this && this.__assign) || function () {

if (s != null && typeof Object.getOwnPropertySymbols === "function")
for (var i = 0, p = Object.getOwnPropertySymbols(s); i < p.length; i++) if (e.indexOf(p[i]) < 0)
t[p[i]] = s[p[i]];
for (var i = 0, p = Object.getOwnPropertySymbols(s); i < p.length; i++) {
if (e.indexOf(p[i]) < 0 && Object.prototype.propertyIsEnumerable.call(s, p[i]))
t[p[i]] = s[p[i]];
}
return t;

@@ -21,0 +23,0 @@ };

{
"name": "@formatjs/intl-unified-numberformat",
"version": "0.4.5",
"version": "0.4.6",
"description": "Ponyfill for intl unified numberformat proposal",

@@ -25,3 +25,3 @@ "keywords": [

"dependencies": {
"@formatjs/intl-utils": "^0.6.1"
"@formatjs/intl-utils": "^0.7.0"
},

@@ -39,3 +39,3 @@ "scripts": {

},
"gitHead": "1aaea879be5e07be2b2e1064998d05ad4a17d370"
"gitHead": "b05a1d489aa6eb6ff8ace60dbc29aaddff206336"
}

Sorry, the diff of this file is too big to display

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is too big to display

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc