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.3 to 0.4.5

22

CHANGELOG.md

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

## [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)
### Bug Fixes
* **@formatjs/intl-unified-numberformat:** fix cldr build ([3cb5dae](https://github.com/formatjs/formatjs/commit/3cb5dae))
## [0.4.4](https://github.com/formatjs/formatjs/compare/@formatjs/intl-unified-numberformat@0.4.3...@formatjs/intl-unified-numberformat@0.4.4) (2019-08-30)
### Bug Fixes
* **@formatjs/intl-unified-numberformat:** export types as well ([99b886b](https://github.com/formatjs/formatjs/commit/99b886b))
## [0.4.3](https://github.com/formatjs/formatjs/compare/@formatjs/intl-unified-numberformat@0.4.2...@formatjs/intl-unified-numberformat@0.4.3) (2019-08-29)

@@ -8,0 +30,0 @@

2

dist/core.d.ts

@@ -32,3 +32,3 @@ import { Unit } from './units-constants';

};
export default class UnifiedNumberFormat implements Intl.NumberFormat {
export declare class UnifiedNumberFormat implements Intl.NumberFormat {
private unit;

@@ -35,0 +35,0 @@ private unitDisplay;

@@ -18,6 +18,4 @@ "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 && Object.prototype.propertyIsEnumerable.call(s, p[i]))
t[p[i]] = s[p[i]];
}
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;

@@ -127,2 +125,2 @@ };

}());
exports.default = UnifiedNumberFormat;
exports.UnifiedNumberFormat = UnifiedNumberFormat;

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

export { default as UnifiedNumberFormat } from './core';
export { Unit } from './units-constants';
export * from './core';
"use strict";
function __export(m) {
for (var p in m) if (!exports.hasOwnProperty(p)) exports[p] = m[p];
}
Object.defineProperty(exports, "__esModule", { value: true });
var core_1 = require("./core");
exports.UnifiedNumberFormat = core_1.default;
__export(require("./core"));

@@ -5,5 +5,5 @@ "use strict";

var en_1 = require("./en");
core_1.default.__addUnitLocaleData(en_1.default);
core_1.UnifiedNumberFormat.__addUnitLocaleData(en_1.default);
if (!core_1.isUnitSupported('bit')) {
Intl.NumberFormat = core_1.default;
Intl.NumberFormat = core_1.UnifiedNumberFormat;
}

@@ -7,2 +7,175 @@ (function (global, factory) {

/**
* @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
*/
/**
* @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
*/
/**
* @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
*/
/**
* @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
*/
/**
* @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
*/
/**
* @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 () {

@@ -66,8 +239,18 @@ __assign = Object.assign || function(t) {

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]];
}
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;

@@ -162,2 +345,3 @@ function findUnitData(locale, unit) {

exports.UnifiedNumberFormat = UnifiedNumberFormat;
exports.isUnitSupported = isUnitSupported;

@@ -164,0 +348,0 @@ Object.defineProperty(exports, '__esModule', { value: true });

@@ -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 l(t,e,n){void 0===n&&(n={});var r,o,i,a,l=(Array.isArray(t)?t:[t]).filter(function(t){return"string"==typeof t}).map(function(t){return n[t]||t}),s=[];for(r=0,o=l.length;r<o;r+=1)for(i=l[r].toLowerCase().split("-");i.length;)if(e){if(a=e[i.join("-")]){s.push(a.locale);break}i.pop()}return s}var s=function(){return(s=Object.assign||function(t){for(var e,n=1,r=arguments.length;n<r;n++)for(var o in e=arguments[n])Object.prototype.hasOwnProperty.call(e,o)&&(t[o]=e[o]);return t}).apply(this,arguments)},u=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 o=0;for(r=Object.getOwnPropertySymbols(t);o<r.length;o++)e.indexOf(r[o])<0&&Object.prototype.propertyIsEnumerable.call(t,r[o])&&(n[r[o]]=t[r[o]])}return n},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,o=e.unitDisplay,i=u(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=o||"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__,o="";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);o=r[e].parentLocale}else o=e.split("-")[0];return t(o,n)}(a,this.unit)}this.nf=new f(t,s({},i,{style:"unit"===n?"decimal":n})),this.locale=this.nf.resolvedOptions().locale}t.UnifiedNumberFormat=c,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 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})});
//# sourceMappingURL=intl-unified-numberformat.min.js.map

@@ -32,3 +32,3 @@ import { Unit } from './units-constants';

};
export default class UnifiedNumberFormat implements Intl.NumberFormat {
export declare class UnifiedNumberFormat implements Intl.NumberFormat {
private unit;

@@ -35,0 +35,0 @@ private unitDisplay;

@@ -17,6 +17,4 @@ 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 && Object.prototype.propertyIsEnumerable.call(s, p[i]))
t[p[i]] = s[p[i]];
}
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;

@@ -124,2 +122,2 @@ };

}());
export default UnifiedNumberFormat;
export { UnifiedNumberFormat };

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

export { default as UnifiedNumberFormat } from './core';
export { Unit } from './units-constants';
export * from './core';

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

export { default as UnifiedNumberFormat } from './core';
export * from './core';

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

import UnifiedNumberFormat, { isUnitSupported } from './core';
import { UnifiedNumberFormat, isUnitSupported } from './core';
import en from './en';

@@ -3,0 +3,0 @@ UnifiedNumberFormat.__addUnitLocaleData(en);

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

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

},
"gitHead": "742dc510af8fc483b5149180be30ff8b86b60c28"
"gitHead": "1aaea879be5e07be2b2e1064998d05ad4a17d370"
}

@@ -76,3 +76,3 @@ import {Unit} from './units-constants';

export default class UnifiedNumberFormat implements Intl.NumberFormat {
export class UnifiedNumberFormat implements Intl.NumberFormat {
private unit: Unit | undefined = undefined;

@@ -79,0 +79,0 @@ private unitDisplay: 'long' | 'short' | 'narrow' | undefined = undefined;

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

export {default as UnifiedNumberFormat} from './core';
export {Unit} from './units-constants';
export * from './core';

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

import UnifiedNumberFormat, {isUnitSupported} from './core';
import {UnifiedNumberFormat, isUnitSupported} from './core';
import en from './en';

@@ -3,0 +3,0 @@

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

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

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

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

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