@formatjs/intl-relativetimeformat
Advanced tools
Comparing version 4.0.0 to 4.0.1
@@ -6,2 +6,16 @@ # Change Log | ||
## [4.0.1](https://github.com/formatjs/formatjs/compare/@formatjs/intl-relativetimeformat@4.0.0...@formatjs/intl-relativetimeformat@4.0.1) (2019-09-17) | ||
### Bug Fixes | ||
* **@formatjs/intl-pluralrules:** merge fix meta into core ([0b10309](https://github.com/formatjs/formatjs/commit/0b10309)) | ||
* **@formatjs/intl-relativetimeformat:** fix type definition for Intl.RelativeTimeFormat ([a16a352](https://github.com/formatjs/formatjs/commit/a16a352)) | ||
* **@formatjs/intl-relativetimeformat:** remove global type mod for RelativeTimeFormat ([4c0b918](https://github.com/formatjs/formatjs/commit/4c0b918)) | ||
* **@formatjs/intl-relativetimeformat:** remove unnecessary meta fix ([5b087bf](https://github.com/formatjs/formatjs/commit/5b087bf)) | ||
# [4.0.0](https://github.com/formatjs/formatjs/compare/@formatjs/intl-relativetimeformat@3.1.0...@formatjs/intl-relativetimeformat@4.0.0) (2019-09-15) | ||
@@ -8,0 +22,0 @@ |
@@ -59,8 +59,7 @@ import { FormattableUnit } from './types'; | ||
private readonly _numberingSystem; | ||
constructor(...[locales, options]: [string | string[] | undefined, IntlRelativeTimeFormatOptions | undefined]); | ||
constructor(locales?: string | string[], options?: IntlRelativeTimeFormatOptions); | ||
format(value: number | string, unit: FormattableUnit): string; | ||
formatToParts(value: number | string, unit: FormattableUnit): Part[]; | ||
resolvedOptions(): ResolvedIntlRelativeTimeFormatOptions; | ||
toString(): string; | ||
static supportedLocalesOf: (locales: string | string[], __1_0: Pick<IntlRelativeTimeFormatOptions, "localeMatcher"> | undefined) => (string | undefined)[]; | ||
static supportedLocalesOf(locales: string | string[], opts?: Pick<IntlRelativeTimeFormatOptions, 'localeMatcher'>): (string | undefined)[]; | ||
static __localeData__: Record<string, RelativeTimeLocaleData>; | ||
@@ -67,0 +66,0 @@ static __addLocaleData(...data: RelativeTimeLocaleData[]): void; |
@@ -99,8 +99,3 @@ "use strict"; | ||
var RelativeTimeFormat = /** @class */ (function () { | ||
function RelativeTimeFormat() { | ||
var _a = []; | ||
for (var _i = 0; _i < arguments.length; _i++) { | ||
_a[_i] = arguments[_i]; | ||
} | ||
var locales = _a[0], options = _a[1]; | ||
function RelativeTimeFormat(locales, options) { | ||
// test262/test/intl402/RelativeTimeFormat/constructor/constructor/newtarget-undefined.js | ||
@@ -215,4 +210,14 @@ // Cannot use `new.target` bc of IE11 & TS transpiles it to something else | ||
}; | ||
RelativeTimeFormat.prototype.toString = function () { | ||
return '[object Intl.RelativeTimeFormat]'; | ||
RelativeTimeFormat.supportedLocalesOf = function (locales, opts) { | ||
// test262/test/intl402/RelativeTimeFormat/constructor/supportedLocalesOf/options-toobject.js | ||
var localeMatcher = 'best fit'; | ||
// test262/test/intl402/RelativeTimeFormat/constructor/supportedLocalesOf/options-null.js | ||
if (opts === null) { | ||
throw new TypeError('opts cannot be null'); | ||
} | ||
if (opts) { | ||
localeMatcher = intl_utils_1.getOption(opts, 'localeMatcher', 'string', ['best fit', 'lookup'], 'best fit'); | ||
} | ||
// test262/test/intl402/RelativeTimeFormat/constructor/supportedLocalesOf/result-type.js | ||
return intl_utils_1.supportedLocalesOf(Intl.NumberFormat.supportedLocalesOf(locales, { localeMatcher: localeMatcher }), RelativeTimeFormat.__localeData__); | ||
}; | ||
@@ -233,20 +238,2 @@ RelativeTimeFormat.__addLocaleData = function () { | ||
}; | ||
RelativeTimeFormat.supportedLocalesOf = function (locales) { | ||
var _a = []; | ||
for (var _i = 1; _i < arguments.length; _i++) { | ||
_a[_i - 1] = arguments[_i]; | ||
} | ||
var opts = _a[0]; | ||
// test262/test/intl402/RelativeTimeFormat/constructor/supportedLocalesOf/options-toobject.js | ||
var localeMatcher = 'best fit'; | ||
// test262/test/intl402/RelativeTimeFormat/constructor/supportedLocalesOf/options-null.js | ||
if (opts === null) { | ||
throw new TypeError('opts cannot be null'); | ||
} | ||
if (opts) { | ||
localeMatcher = intl_utils_1.getOption(opts, 'localeMatcher', 'string', ['best fit', 'lookup'], 'best fit'); | ||
} | ||
// test262/test/intl402/RelativeTimeFormat/constructor/supportedLocalesOf/result-type.js | ||
return intl_utils_1.supportedLocalesOf(Intl.NumberFormat.supportedLocalesOf(locales, { localeMatcher: localeMatcher }), RelativeTimeFormat.__localeData__); | ||
}; | ||
RelativeTimeFormat.__localeData__ = {}; | ||
@@ -257,1 +244,29 @@ RelativeTimeFormat.polyfilled = true; | ||
exports.default = RelativeTimeFormat; | ||
try { | ||
// IE11 does not have Symbol | ||
if (typeof Symbol !== 'undefined') { | ||
Object.defineProperty(RelativeTimeFormat.prototype, Symbol.toStringTag, { | ||
value: 'Intl.RelativeTimeFormat', | ||
writable: false, | ||
enumerable: false, | ||
configurable: true, | ||
}); | ||
} | ||
// https://github.com/tc39/test262/blob/master/test/intl402/RelativeTimeFormat/constructor/length.js | ||
Object.defineProperty(RelativeTimeFormat.prototype.constructor, 'length', { | ||
value: 0, | ||
writable: false, | ||
enumerable: false, | ||
configurable: true, | ||
}); | ||
// https://github.com/tc39/test262/blob/master/test/intl402/RelativeTimeFormat/constructor/supportedLocalesOf/length.js | ||
Object.defineProperty(RelativeTimeFormat.supportedLocalesOf, 'length', { | ||
value: 1, | ||
writable: false, | ||
enumerable: false, | ||
configurable: true, | ||
}); | ||
} | ||
catch (e) { | ||
// Meta fix so we're test262-compliant, not important | ||
} |
@@ -1,1 +0,2 @@ | ||
export {}; | ||
import './polyfill'; | ||
import './locales'; |
"use strict"; | ||
Object.defineProperty(exports, "__esModule", { value: true }); | ||
var fix_meta_1 = require("./fix-meta"); | ||
var locales_1 = require("./locales"); | ||
fix_meta_1.default(locales_1.default); | ||
require("./polyfill"); | ||
require("./locales"); |
"use strict"; | ||
Object.defineProperty(exports, "__esModule", { value: true }); | ||
var fix_meta_1 = require("./fix-meta"); | ||
var _1 = require("./"); | ||
fix_meta_1.default(_1.default); | ||
var core_1 = require("./core"); | ||
if (!('RelativeTimeFormat' in Intl)) { | ||
Object.defineProperty(Intl, 'RelativeTimeFormat', { | ||
value: core_1.default, | ||
writable: true, | ||
enumerable: false, | ||
configurable: true, | ||
}); | ||
} |
@@ -234,8 +234,3 @@ (function (global, factory) { | ||
var RelativeTimeFormat = /** @class */ (function () { | ||
function RelativeTimeFormat() { | ||
var _a = []; | ||
for (var _i = 0; _i < arguments.length; _i++) { | ||
_a[_i] = arguments[_i]; | ||
} | ||
var locales = _a[0], options = _a[1]; | ||
function RelativeTimeFormat(locales, options) { | ||
// test262/test/intl402/RelativeTimeFormat/constructor/constructor/newtarget-undefined.js | ||
@@ -350,4 +345,14 @@ // Cannot use `new.target` bc of IE11 & TS transpiles it to something else | ||
}; | ||
RelativeTimeFormat.prototype.toString = function () { | ||
return '[object Intl.RelativeTimeFormat]'; | ||
RelativeTimeFormat.supportedLocalesOf = function (locales, opts) { | ||
// test262/test/intl402/RelativeTimeFormat/constructor/supportedLocalesOf/options-toobject.js | ||
var localeMatcher = 'best fit'; | ||
// test262/test/intl402/RelativeTimeFormat/constructor/supportedLocalesOf/options-null.js | ||
if (opts === null) { | ||
throw new TypeError('opts cannot be null'); | ||
} | ||
if (opts) { | ||
localeMatcher = getOption(opts, 'localeMatcher', 'string', ['best fit', 'lookup'], 'best fit'); | ||
} | ||
// test262/test/intl402/RelativeTimeFormat/constructor/supportedLocalesOf/result-type.js | ||
return supportedLocalesOf(Intl.NumberFormat.supportedLocalesOf(locales, { localeMatcher: localeMatcher }), RelativeTimeFormat.__localeData__); | ||
}; | ||
@@ -368,20 +373,2 @@ RelativeTimeFormat.__addLocaleData = function () { | ||
}; | ||
RelativeTimeFormat.supportedLocalesOf = function (locales) { | ||
var _a = []; | ||
for (var _i = 1; _i < arguments.length; _i++) { | ||
_a[_i - 1] = arguments[_i]; | ||
} | ||
var opts = _a[0]; | ||
// test262/test/intl402/RelativeTimeFormat/constructor/supportedLocalesOf/options-toobject.js | ||
var localeMatcher = 'best fit'; | ||
// test262/test/intl402/RelativeTimeFormat/constructor/supportedLocalesOf/options-null.js | ||
if (opts === null) { | ||
throw new TypeError('opts cannot be null'); | ||
} | ||
if (opts) { | ||
localeMatcher = getOption(opts, 'localeMatcher', 'string', ['best fit', 'lookup'], 'best fit'); | ||
} | ||
// test262/test/intl402/RelativeTimeFormat/constructor/supportedLocalesOf/result-type.js | ||
return supportedLocalesOf(Intl.NumberFormat.supportedLocalesOf(locales, { localeMatcher: localeMatcher }), RelativeTimeFormat.__localeData__); | ||
}; | ||
RelativeTimeFormat.__localeData__ = {}; | ||
@@ -391,2 +378,30 @@ RelativeTimeFormat.polyfilled = true; | ||
}()); | ||
try { | ||
// IE11 does not have Symbol | ||
if (typeof Symbol !== 'undefined') { | ||
Object.defineProperty(RelativeTimeFormat.prototype, Symbol.toStringTag, { | ||
value: 'Intl.RelativeTimeFormat', | ||
writable: false, | ||
enumerable: false, | ||
configurable: true, | ||
}); | ||
} | ||
// https://github.com/tc39/test262/blob/master/test/intl402/RelativeTimeFormat/constructor/length.js | ||
Object.defineProperty(RelativeTimeFormat.prototype.constructor, 'length', { | ||
value: 0, | ||
writable: false, | ||
enumerable: false, | ||
configurable: true, | ||
}); | ||
// https://github.com/tc39/test262/blob/master/test/intl402/RelativeTimeFormat/constructor/supportedLocalesOf/length.js | ||
Object.defineProperty(RelativeTimeFormat.supportedLocalesOf, 'length', { | ||
value: 1, | ||
writable: false, | ||
enumerable: false, | ||
configurable: true, | ||
}); | ||
} | ||
catch (e) { | ||
// Meta fix so we're test262-compliant, not important | ||
} | ||
@@ -393,0 +408,0 @@ exports.VALID_UNITS = VALID_UNITS; |
@@ -1,2 +0,2 @@ | ||
!function(e,n){"object"==typeof exports&&"undefined"!=typeof module?n(exports):"function"==typeof define&&define.amd?define(["exports"],n):n((e=e||self).IntlRelativeTimeFormat={})}(this,function(e){"use strict";var n=["second","minute","hour","day","week","month","quarter","year","seconds","minutes","hours","days","weeks","months","quarters","years"],l={"aa-SAAHO":"ssy",aam:"aas",aar:"aa",abk:"ab",adp:"dz",afr:"af",aju:"jrb",aka:"ak",alb:"sq",als:"sq",amh:"am",ara:"ar",arb:"ar",arg:"an",arm:"hy","art-lojban":"jbo",asm:"as",aue:"ktz",ava:"av",ave:"ae",aym:"ay",ayr:"ay",ayx:"nun","az-AZ":"az-Latn-AZ",aze:"az",azj:"az",bak:"ba",bam:"bm",baq:"eu",bcc:"bal",bcl:"bik",bel:"be",ben:"bn",bgm:"bcg",bh:"bho",bih:"bho",bis:"bi",bjd:"drl",bod:"bo",bos:"bs",bre:"br","bs-BA":"bs-Latn-BA",bul:"bg",bur:"my",bxk:"luy",bxr:"bua",cat:"ca",ccq:"rki","cel-gaulish":"xtg-x-cel-gaulish",ces:"cs",cha:"ch",che:"ce",chi:"zh",chu:"cu",chv:"cv",cjr:"mom",cka:"cmr",cld:"syr",cmk:"xch",cmn:"zh",cnr:"sr-ME",cor:"kw",cos:"co",coy:"pij",cqu:"quh",cre:"cr",cwd:"cr",cym:"cy",cze:"cs",dan:"da",deu:"de",dgo:"doi",dhd:"mwr",dik:"din",diq:"zza",div:"dv",drh:"mn",drw:"fa-af",dut:"nl",dzo:"dz",ekk:"et",ell:"el",emk:"man",eng:"en",epo:"eo",esk:"ik",est:"et",eus:"eu",ewe:"ee",fao:"fo",fas:"fa",fat:"ak",fij:"fj",fin:"fi",fra:"fr",fre:"fr",fry:"fy",fuc:"ff",ful:"ff",gav:"dev",gaz:"om",gbo:"grb",geo:"ka",ger:"de",gfx:"vaj",ggn:"gvr",gla:"gd",gle:"ga",glg:"gl",glv:"gv",gno:"gon",gre:"el",grn:"gn",gti:"nyc",gug:"gn",guj:"gu",guv:"duz",gya:"gba","ha-Latn-GH":"ha-GH","ha-Latn-NE":"ha-NE","ha-Latn-NG":"ha-NG",hat:"ht",hau:"ha",hbs:"sr-Latn",hdn:"hai",hea:"hmn",heb:"he",her:"hz",him:"srx",hin:"hi",hmo:"ho",hrr:"jal",hrv:"hr",hun:"hu",hye:"hy","i-ami":"ami","i-bnn":"bnn","i-hak":"hak","i-klingon":"tlh","i-lux":"lb","i-navajo":"nv","i-pwn":"pwn","i-tao":"tao","i-tay":"tay","i-tsu":"tsu","i-default":"en-x-i-default","i-enochian":"und-x-i-enochian","i-mingo":"see-x-i-mingo",ibi:"opa",ibo:"ig",ice:"is",ido:"io",iii:"ii",ike:"iu",iku:"iu",ile:"ie",ilw:"gal",in:"id",ina:"ia",ind:"id",ipk:"ik",isl:"is",ita:"it",iw:"he",jav:"jv",jeg:"oyb",ji:"yi",jpn:"ja",jw:"jv",kal:"kl",kan:"kn",kas:"ks",kat:"ka",kau:"kr",kaz:"kk",kgc:"tdf",kgh:"kml",khk:"mn",khm:"km",kik:"ki",kin:"rw",kir:"ky","kk-Cyrl-KZ":"kk-KZ",kmr:"ku",knc:"kr",kng:"kg",knn:"kok",koj:"kwv",kom:"kv",kon:"kg",kor:"ko",kpv:"kv",krm:"bmf","ks-Arab-IN":"ks-IN",ktr:"dtp",kua:"kj",kur:"ku",kvs:"gdj",kwq:"yam",kxe:"tvd","ky-Cyrl-KG":"ky-KG",kzj:"dtp",kzt:"dtp",lao:"lo",lat:"la",lav:"lv",lbk:"bnc",lii:"raq",lim:"li",lin:"ln",lit:"lt",lmm:"rmx",ltz:"lb",lub:"lu",lug:"lg",lvs:"lv",mac:"mk",mah:"mh",mal:"ml",mao:"mi",mar:"mr",may:"ms",meg:"cir",mhr:"chm",mkd:"mk",mlg:"mg",mlt:"mt","mn-Cyrl-MN":"mn-MN",mnk:"man",mo:"ro",mol:"ro",mon:"mn",mri:"mi","ms-Latn-BN":"ms-BN","ms-Latn-MY":"ms-MY","ms-Latn-SG":"ms-SG",msa:"ms",mst:"mry",mup:"raj",mwj:"vaj",mya:"my",myt:"mry",nad:"xny",nau:"na",nav:"nv",nbl:"nr",ncp:"kdz",nde:"nd",ndo:"ng",nep:"ne",nld:"nl",nno:"nn",nnx:"ngv",no:"nb","no-bok":"nb","no-BOKMAL":"nb","no-nyn":"nn","no-NYNORSK":"nn",nob:"nb",nor:"nb",npi:"ne",nts:"pij",nya:"ny",oci:"oc",ojg:"oj",oji:"oj",ori:"or",orm:"om",ory:"or",oss:"os",oun:"vaj","pa-IN":"pa-Guru-IN","pa-PK":"pa-Arab-PK",pan:"pa",pbu:"ps",pcr:"adx",per:"fa",pes:"fa",pli:"pi",plt:"mg",pmc:"huw",pmu:"phr",pnb:"lah",pol:"pl",por:"pt",ppa:"bfy",ppr:"lcq",prs:"fa-AF",pry:"prt",pus:"ps",puz:"pub",que:"qu",quz:"qu",rmy:"rom",roh:"rm",ron:"ro",rum:"ro",run:"rn",rus:"ru",sag:"sg",san:"sa",sca:"hle",scc:"sr",scr:"hr","sgn-BE-FR":"sfb","sgn-BE-NL":"vgt","sgn-CH-DE":"sgg",sh:"sr-Latn","shi-MA":"shi-Tfng-MA",sin:"si",skk:"oyb",slk:"sk",slo:"sk",slv:"sl",sme:"se",smo:"sm",sna:"sn",snd:"sd",som:"so",sot:"st",spa:"es",spy:"kln",sqi:"sq","sr-BA":"sr-Cyrl-BA","sr-ME":"sr-Latn-ME","sr-RS":"sr-Cyrl-RS","sr-XK":"sr-Cyrl-XK",src:"sc",srd:"sc",srp:"sr",ssw:"ss",sun:"su",swa:"sw",swc:"sw-CD",swe:"sv",swh:"sw",tah:"ty",tam:"ta",tat:"tt",tdu:"dtp",tel:"te",tgk:"tg",tgl:"fil",tha:"th",thc:"tpo",thx:"oyb",tib:"bo",tie:"ras",tir:"ti",tkk:"twm",tl:"fil",tlw:"weo",tmp:"tyj",tne:"kak",tnf:"fa-af",ton:"to",tsf:"taj",tsn:"tn",tso:"ts",ttq:"tmh",tuk:"tk",tur:"tr",tw:"ak",twi:"ak","tzm-Latn-MA":"tzm-MA","ug-Arab-CN":"ug-CN",uig:"ug",ukr:"uk",umu:"del",uok:"ema",urd:"ur","uz-AF":"uz-Arab-AF","uz-UZ":"uz-Latn-UZ",uzb:"uz",uzn:"uz","vai-LR":"vai-Vaii-LR",ven:"ve",vie:"vi",vol:"vo",wel:"cy",wln:"wa",wol:"wo",xba:"cax",xho:"xh",xia:"acn",xkh:"waw",xpe:"kpe",xsj:"suj",xsl:"den",ybd:"rki",ydd:"yi",yid:"yi",yma:"lrr",ymt:"mtm",yor:"yo",yos:"zom","yue-CN":"yue-Hans-CN","yue-HK":"yue-Hant-HK",yuu:"yug",zai:"zap","zh-CN":"zh-Hans-CN","zh-guoyu":"zh","zh-hakka":"hak","zh-HK":"zh-Hant-HK","zh-min-nan":"nan","zh-MO":"zh-Hant-MO","zh-SG":"zh-Hans-SG","zh-TW":"zh-Hant-TW","zh-xiang":"hsn","zh-min":"nan-x-zh-min",zha:"za",zho:"zh",zsm:"ms",zul:"zu",zyb:"za"},o={"en-150":"en-001","en-AG":"en-001","en-AI":"en-001","en-AU":"en-001","en-BB":"en-001","en-BM":"en-001","en-BS":"en-001","en-BW":"en-001","en-BZ":"en-001","en-CA":"en-001","en-CC":"en-001","en-CK":"en-001","en-CM":"en-001","en-CX":"en-001","en-CY":"en-001","en-DG":"en-001","en-DM":"en-001","en-ER":"en-001","en-FJ":"en-001","en-FK":"en-001","en-FM":"en-001","en-GB":"en-001","en-GD":"en-001","en-GG":"en-001","en-GH":"en-001","en-GI":"en-001","en-GM":"en-001","en-GY":"en-001","en-HK":"en-001","en-IE":"en-001","en-IL":"en-001","en-IM":"en-001","en-IN":"en-001","en-IO":"en-001","en-JE":"en-001","en-JM":"en-001","en-KE":"en-001","en-KI":"en-001","en-KN":"en-001","en-KY":"en-001","en-LC":"en-001","en-LR":"en-001","en-LS":"en-001","en-MG":"en-001","en-MO":"en-001","en-MS":"en-001","en-MT":"en-001","en-MU":"en-001","en-MW":"en-001","en-MY":"en-001","en-NA":"en-001","en-NF":"en-001","en-NG":"en-001","en-NR":"en-001","en-NU":"en-001","en-NZ":"en-001","en-PG":"en-001","en-PH":"en-001","en-PK":"en-001","en-PN":"en-001","en-PW":"en-001","en-RW":"en-001","en-SB":"en-001","en-SC":"en-001","en-SD":"en-001","en-SG":"en-001","en-SH":"en-001","en-SL":"en-001","en-SS":"en-001","en-SX":"en-001","en-SZ":"en-001","en-TC":"en-001","en-TK":"en-001","en-TO":"en-001","en-TT":"en-001","en-TV":"en-001","en-TZ":"en-001","en-UG":"en-001","en-VC":"en-001","en-VG":"en-001","en-VU":"en-001","en-WS":"en-001","en-ZA":"en-001","en-ZM":"en-001","en-ZW":"en-001","en-AT":"en-150","en-BE":"en-150","en-CH":"en-150","en-DE":"en-150","en-DK":"en-150","en-FI":"en-150","en-NL":"en-150","en-SE":"en-150","en-SI":"en-150","es-AR":"es-419","es-BO":"es-419","es-BR":"es-419","es-BZ":"es-419","es-CL":"es-419","es-CO":"es-419","es-CR":"es-419","es-CU":"es-419","es-DO":"es-419","es-EC":"es-419","es-GT":"es-419","es-HN":"es-419","es-MX":"es-419","es-NI":"es-419","es-PA":"es-419","es-PE":"es-419","es-PR":"es-419","es-PY":"es-419","es-SV":"es-419","es-US":"es-419","es-UY":"es-419","es-VE":"es-419","pt-AO":"pt-PT","pt-CH":"pt-PT","pt-CV":"pt-PT","pt-FR":"pt-PT","pt-GQ":"pt-PT","pt-GW":"pt-PT","pt-LU":"pt-PT","pt-MO":"pt-PT","pt-MZ":"pt-PT","pt-ST":"pt-PT","pt-TL":"pt-PT","zh-Hant-MO":"zh-Hant-HK"};function u(e){var n=[];e=l[e]||e;var t=o[e];t&&n.push(t);for(var r=e.split("-"),a=r.length;1<a;a--)n.push(r.slice(0,a-1).join("-"));return n}function s(e,n){if(e){var t=e.toLowerCase();if(t in n)return n[t].locale||e;var r=l[e];if(r){var a=r.toLowerCase();if(a in n)return n[a].locale||r}for(var o=u(e),i=e;i;)if(i=o.shift()){var s=i.toLowerCase();if(s in n)return n[s].locale||i}}}function h(e,n,t,r,a){var o=e[n];if(void 0===o)return a;if("boolean"!==t&&"string"!==t)throw new TypeError("invalid type");if("boolean"===t&&(o=new Boolean(o)),"string"===t&&(o=new String(o)),void 0!==r&&!r.filter(function(e){return e==o}).length)throw new RangeError(o+" in not within "+r);return o}var p=function(){return(p=Object.assign||function(e){for(var n,t=1,r=arguments.length;t<r;t++)for(var a in n=arguments[t])Object.prototype.hasOwnProperty.call(n,a)&&(e[a]=n[a]);return e}).apply(this,arguments)},b=function(){for(var e=0,n=0,t=arguments.length;n<t;n++)e+=arguments[n].length;var r=Array(e),a=0;for(n=0;n<t;n++)for(var o=arguments[n],i=0,s=o.length;i<s;i++,a++)r[a]=o[i];return r};function g(e,n,t){return"long"==t?e[n]:"narrow"==t&&e[n+"-narrow"]||e[n+"-short"]}function t(e,n){return Object.is?Object.is(e,n):e===n?0!==e||1/e==1/n:e!=e&&n!=n}function d(e){return t(e,-0)?"past":t(e,0)?"future":e<0?"past":"future"}function k(e,n){if(!(e instanceof c))throw new TypeError("Method Intl.RelativeTimeFormat.prototype."+n+" called on incompatible receiver "+String(e))}function v(e){if(!~n.indexOf(e+""))throw new RangeError("Invalid unit argument for format() '"+String(e)+"'");return"s"===e[e.length-1]?e.slice(0,e.length-1):e}function y(e,n){void 0===n&&(n="format");var t="string"==typeof e?new Number(e).valueOf():e;if(!isFinite(t))throw new RangeError("Value need to be finite number for Intl.RelativeTimeFormat.prototype."+n+"()");return t}function w(e){return!!e}var m=(new Intl.NumberFormat).resolvedOptions().locale,c=(f.prototype.format=function(e,n){k(this,"format");var t=v(n),r=y(e),a=this._style,o=this._numeric,i=g(this._fields,t,a);if(!i)throw new Error("Unsupported unit "+n);var s=i.relative,l=i.relativeTime,u="";if("auto"==o&&(u=s[String(r)]||""))return u;var h=this._pl.select(r),m=l[d(r)];return(m[h]||m.other).replace(/\{0\}/,this._nf.format(Math.abs(r)))},f.prototype.formatToParts=function(e,n){k(this,"format");var t=v(n),r=y(e,"formatToParts"),a=this._style,o=this._numeric,i=g(this._fields,t,a);if(!i)throw new Error("Unsupported unit "+n);var s=i.relative,l=i.relativeTime,u="";if("auto"==o&&(u=s[String(r)]||""))return[{type:"literal",value:u}];var h=this._pl.select(r),m=l[d(r)],c=m[h]||m.other,f=this._nf.formatToParts(Math.abs(r)).map(function(e){return p(p({},e),{unit:t})});return c.split(/(\{0\})/).filter(w).reduce(function(e,n){return b(e,"{0}"===n?f:[{type:"literal",value:n}])},[])},f.prototype.resolvedOptions=function(){k(this,"resolvedOptions");var e=Object.create(Object.prototype);return Object.defineProperties(e,{locale:{value:this._nf.resolvedOptions().locale,writable:!0,enumerable:!0,configurable:!0},style:{value:this._style.valueOf(),writable:!0,enumerable:!0,configurable:!0},numeric:{value:this._numeric.valueOf(),writable:!0,enumerable:!0,configurable:!0},numberingSystem:{value:this._numberingSystem.valueOf(),writable:!0,enumerable:!0,configurable:!0}}),e},f.prototype.toString=function(){return"[object Intl.RelativeTimeFormat]"},f.__addLocaleData=function(){for(var e=[],n=0;n<arguments.length;n++)e[n]=arguments[n];for(var t=0,r=e;t<r.length;t++){var a=r[t];if(!a||!a.locale)throw new Error("Locale data provided to RelativeTimeFormat is missing a `locale` property value");f.__localeData__[a.locale.toLowerCase()]=a}},f.supportedLocalesOf=function(e){for(var n=[],t=1;t<arguments.length;t++)n[t-1]=arguments[t];var r=n[0],a="best fit";if(null===r)throw new TypeError("opts cannot be null");return r&&(a=h(r,"localeMatcher","string",["best fit","lookup"],"best fit")),function(e,n){return(Array.isArray(e)?e:[e]).filter(function(e){return!!s(e,n)})}(Intl.NumberFormat.supportedLocalesOf(e,{localeMatcher:a}),f.__localeData__)},f.__localeData__={},f.polyfilled=!0,f);function f(){for(var e=[],n=0;n<arguments.length;n++)e[n]=arguments[n];var t=e[0],r=e[1];if(!(this&&this instanceof f?this.constructor:void 0))throw new TypeError("Intl.RelativeTimeFormat must be called with 'new'");var a=void 0===r?Object.create(null):function(e){if(null==e)throw new TypeError("undefined/null cannot be converted to object");return Object(e)}(r),o=void 0===t?[m]:b(Intl.NumberFormat.supportedLocalesOf(t),[m]),i=function(e,n){for(var t=Array.isArray(e)?e:[e],r=0;r<t.length;r++){var a=s(t[r],n);if(a)return a}}(o,f.__localeData__);if(!i)throw new Error("No locale data has been added to IntlRelativeTimeFormat for: "+o.join(", "));this._fields=function(e){var n=c.__localeData__,t=u(e),r=b([e],t).map(function(e){return n[e.toLowerCase()]}).filter(Boolean);if(!r.length)throw new Error("Locale data added to RelativeTimeFormat is missing 'fields' for \""+e+'"');return r.reverse(),r.reduce(function(e,n){return p(p({},e),n.fields)},{})}(i),this._localeMatcher=h(a,"localeMatcher","string",["best fit","lookup"],"best fit"),this._style=h(a,"style","string",["long","narrow","short"],"long"),this._numeric=h(a,"numeric","string",["always","auto"],"always"),this._nf=new Intl.NumberFormat(t),this._pl=new Intl.PluralRules(t),this._numberingSystem=this._nf.resolvedOptions().numberingSystem}e.VALID_UNITS=n,e.default=c,Object.defineProperty(e,"__esModule",{value:!0})}); | ||
!function(e,n){"object"==typeof exports&&"undefined"!=typeof module?n(exports):"function"==typeof define&&define.amd?define(["exports"],n):n((e=e||self).IntlRelativeTimeFormat={})}(this,function(e){"use strict";var n=["second","minute","hour","day","week","month","quarter","year","seconds","minutes","hours","days","weeks","months","quarters","years"],l={"aa-SAAHO":"ssy",aam:"aas",aar:"aa",abk:"ab",adp:"dz",afr:"af",aju:"jrb",aka:"ak",alb:"sq",als:"sq",amh:"am",ara:"ar",arb:"ar",arg:"an",arm:"hy","art-lojban":"jbo",asm:"as",aue:"ktz",ava:"av",ave:"ae",aym:"ay",ayr:"ay",ayx:"nun","az-AZ":"az-Latn-AZ",aze:"az",azj:"az",bak:"ba",bam:"bm",baq:"eu",bcc:"bal",bcl:"bik",bel:"be",ben:"bn",bgm:"bcg",bh:"bho",bih:"bho",bis:"bi",bjd:"drl",bod:"bo",bos:"bs",bre:"br","bs-BA":"bs-Latn-BA",bul:"bg",bur:"my",bxk:"luy",bxr:"bua",cat:"ca",ccq:"rki","cel-gaulish":"xtg-x-cel-gaulish",ces:"cs",cha:"ch",che:"ce",chi:"zh",chu:"cu",chv:"cv",cjr:"mom",cka:"cmr",cld:"syr",cmk:"xch",cmn:"zh",cnr:"sr-ME",cor:"kw",cos:"co",coy:"pij",cqu:"quh",cre:"cr",cwd:"cr",cym:"cy",cze:"cs",dan:"da",deu:"de",dgo:"doi",dhd:"mwr",dik:"din",diq:"zza",div:"dv",drh:"mn",drw:"fa-af",dut:"nl",dzo:"dz",ekk:"et",ell:"el",emk:"man",eng:"en",epo:"eo",esk:"ik",est:"et",eus:"eu",ewe:"ee",fao:"fo",fas:"fa",fat:"ak",fij:"fj",fin:"fi",fra:"fr",fre:"fr",fry:"fy",fuc:"ff",ful:"ff",gav:"dev",gaz:"om",gbo:"grb",geo:"ka",ger:"de",gfx:"vaj",ggn:"gvr",gla:"gd",gle:"ga",glg:"gl",glv:"gv",gno:"gon",gre:"el",grn:"gn",gti:"nyc",gug:"gn",guj:"gu",guv:"duz",gya:"gba","ha-Latn-GH":"ha-GH","ha-Latn-NE":"ha-NE","ha-Latn-NG":"ha-NG",hat:"ht",hau:"ha",hbs:"sr-Latn",hdn:"hai",hea:"hmn",heb:"he",her:"hz",him:"srx",hin:"hi",hmo:"ho",hrr:"jal",hrv:"hr",hun:"hu",hye:"hy","i-ami":"ami","i-bnn":"bnn","i-hak":"hak","i-klingon":"tlh","i-lux":"lb","i-navajo":"nv","i-pwn":"pwn","i-tao":"tao","i-tay":"tay","i-tsu":"tsu","i-default":"en-x-i-default","i-enochian":"und-x-i-enochian","i-mingo":"see-x-i-mingo",ibi:"opa",ibo:"ig",ice:"is",ido:"io",iii:"ii",ike:"iu",iku:"iu",ile:"ie",ilw:"gal",in:"id",ina:"ia",ind:"id",ipk:"ik",isl:"is",ita:"it",iw:"he",jav:"jv",jeg:"oyb",ji:"yi",jpn:"ja",jw:"jv",kal:"kl",kan:"kn",kas:"ks",kat:"ka",kau:"kr",kaz:"kk",kgc:"tdf",kgh:"kml",khk:"mn",khm:"km",kik:"ki",kin:"rw",kir:"ky","kk-Cyrl-KZ":"kk-KZ",kmr:"ku",knc:"kr",kng:"kg",knn:"kok",koj:"kwv",kom:"kv",kon:"kg",kor:"ko",kpv:"kv",krm:"bmf","ks-Arab-IN":"ks-IN",ktr:"dtp",kua:"kj",kur:"ku",kvs:"gdj",kwq:"yam",kxe:"tvd","ky-Cyrl-KG":"ky-KG",kzj:"dtp",kzt:"dtp",lao:"lo",lat:"la",lav:"lv",lbk:"bnc",lii:"raq",lim:"li",lin:"ln",lit:"lt",lmm:"rmx",ltz:"lb",lub:"lu",lug:"lg",lvs:"lv",mac:"mk",mah:"mh",mal:"ml",mao:"mi",mar:"mr",may:"ms",meg:"cir",mhr:"chm",mkd:"mk",mlg:"mg",mlt:"mt","mn-Cyrl-MN":"mn-MN",mnk:"man",mo:"ro",mol:"ro",mon:"mn",mri:"mi","ms-Latn-BN":"ms-BN","ms-Latn-MY":"ms-MY","ms-Latn-SG":"ms-SG",msa:"ms",mst:"mry",mup:"raj",mwj:"vaj",mya:"my",myt:"mry",nad:"xny",nau:"na",nav:"nv",nbl:"nr",ncp:"kdz",nde:"nd",ndo:"ng",nep:"ne",nld:"nl",nno:"nn",nnx:"ngv",no:"nb","no-bok":"nb","no-BOKMAL":"nb","no-nyn":"nn","no-NYNORSK":"nn",nob:"nb",nor:"nb",npi:"ne",nts:"pij",nya:"ny",oci:"oc",ojg:"oj",oji:"oj",ori:"or",orm:"om",ory:"or",oss:"os",oun:"vaj","pa-IN":"pa-Guru-IN","pa-PK":"pa-Arab-PK",pan:"pa",pbu:"ps",pcr:"adx",per:"fa",pes:"fa",pli:"pi",plt:"mg",pmc:"huw",pmu:"phr",pnb:"lah",pol:"pl",por:"pt",ppa:"bfy",ppr:"lcq",prs:"fa-AF",pry:"prt",pus:"ps",puz:"pub",que:"qu",quz:"qu",rmy:"rom",roh:"rm",ron:"ro",rum:"ro",run:"rn",rus:"ru",sag:"sg",san:"sa",sca:"hle",scc:"sr",scr:"hr","sgn-BE-FR":"sfb","sgn-BE-NL":"vgt","sgn-CH-DE":"sgg",sh:"sr-Latn","shi-MA":"shi-Tfng-MA",sin:"si",skk:"oyb",slk:"sk",slo:"sk",slv:"sl",sme:"se",smo:"sm",sna:"sn",snd:"sd",som:"so",sot:"st",spa:"es",spy:"kln",sqi:"sq","sr-BA":"sr-Cyrl-BA","sr-ME":"sr-Latn-ME","sr-RS":"sr-Cyrl-RS","sr-XK":"sr-Cyrl-XK",src:"sc",srd:"sc",srp:"sr",ssw:"ss",sun:"su",swa:"sw",swc:"sw-CD",swe:"sv",swh:"sw",tah:"ty",tam:"ta",tat:"tt",tdu:"dtp",tel:"te",tgk:"tg",tgl:"fil",tha:"th",thc:"tpo",thx:"oyb",tib:"bo",tie:"ras",tir:"ti",tkk:"twm",tl:"fil",tlw:"weo",tmp:"tyj",tne:"kak",tnf:"fa-af",ton:"to",tsf:"taj",tsn:"tn",tso:"ts",ttq:"tmh",tuk:"tk",tur:"tr",tw:"ak",twi:"ak","tzm-Latn-MA":"tzm-MA","ug-Arab-CN":"ug-CN",uig:"ug",ukr:"uk",umu:"del",uok:"ema",urd:"ur","uz-AF":"uz-Arab-AF","uz-UZ":"uz-Latn-UZ",uzb:"uz",uzn:"uz","vai-LR":"vai-Vaii-LR",ven:"ve",vie:"vi",vol:"vo",wel:"cy",wln:"wa",wol:"wo",xba:"cax",xho:"xh",xia:"acn",xkh:"waw",xpe:"kpe",xsj:"suj",xsl:"den",ybd:"rki",ydd:"yi",yid:"yi",yma:"lrr",ymt:"mtm",yor:"yo",yos:"zom","yue-CN":"yue-Hans-CN","yue-HK":"yue-Hant-HK",yuu:"yug",zai:"zap","zh-CN":"zh-Hans-CN","zh-guoyu":"zh","zh-hakka":"hak","zh-HK":"zh-Hant-HK","zh-min-nan":"nan","zh-MO":"zh-Hant-MO","zh-SG":"zh-Hans-SG","zh-TW":"zh-Hant-TW","zh-xiang":"hsn","zh-min":"nan-x-zh-min",zha:"za",zho:"zh",zsm:"ms",zul:"zu",zyb:"za"},o={"en-150":"en-001","en-AG":"en-001","en-AI":"en-001","en-AU":"en-001","en-BB":"en-001","en-BM":"en-001","en-BS":"en-001","en-BW":"en-001","en-BZ":"en-001","en-CA":"en-001","en-CC":"en-001","en-CK":"en-001","en-CM":"en-001","en-CX":"en-001","en-CY":"en-001","en-DG":"en-001","en-DM":"en-001","en-ER":"en-001","en-FJ":"en-001","en-FK":"en-001","en-FM":"en-001","en-GB":"en-001","en-GD":"en-001","en-GG":"en-001","en-GH":"en-001","en-GI":"en-001","en-GM":"en-001","en-GY":"en-001","en-HK":"en-001","en-IE":"en-001","en-IL":"en-001","en-IM":"en-001","en-IN":"en-001","en-IO":"en-001","en-JE":"en-001","en-JM":"en-001","en-KE":"en-001","en-KI":"en-001","en-KN":"en-001","en-KY":"en-001","en-LC":"en-001","en-LR":"en-001","en-LS":"en-001","en-MG":"en-001","en-MO":"en-001","en-MS":"en-001","en-MT":"en-001","en-MU":"en-001","en-MW":"en-001","en-MY":"en-001","en-NA":"en-001","en-NF":"en-001","en-NG":"en-001","en-NR":"en-001","en-NU":"en-001","en-NZ":"en-001","en-PG":"en-001","en-PH":"en-001","en-PK":"en-001","en-PN":"en-001","en-PW":"en-001","en-RW":"en-001","en-SB":"en-001","en-SC":"en-001","en-SD":"en-001","en-SG":"en-001","en-SH":"en-001","en-SL":"en-001","en-SS":"en-001","en-SX":"en-001","en-SZ":"en-001","en-TC":"en-001","en-TK":"en-001","en-TO":"en-001","en-TT":"en-001","en-TV":"en-001","en-TZ":"en-001","en-UG":"en-001","en-VC":"en-001","en-VG":"en-001","en-VU":"en-001","en-WS":"en-001","en-ZA":"en-001","en-ZM":"en-001","en-ZW":"en-001","en-AT":"en-150","en-BE":"en-150","en-CH":"en-150","en-DE":"en-150","en-DK":"en-150","en-FI":"en-150","en-NL":"en-150","en-SE":"en-150","en-SI":"en-150","es-AR":"es-419","es-BO":"es-419","es-BR":"es-419","es-BZ":"es-419","es-CL":"es-419","es-CO":"es-419","es-CR":"es-419","es-CU":"es-419","es-DO":"es-419","es-EC":"es-419","es-GT":"es-419","es-HN":"es-419","es-MX":"es-419","es-NI":"es-419","es-PA":"es-419","es-PE":"es-419","es-PR":"es-419","es-PY":"es-419","es-SV":"es-419","es-US":"es-419","es-UY":"es-419","es-VE":"es-419","pt-AO":"pt-PT","pt-CH":"pt-PT","pt-CV":"pt-PT","pt-FR":"pt-PT","pt-GQ":"pt-PT","pt-GW":"pt-PT","pt-LU":"pt-PT","pt-MO":"pt-PT","pt-MZ":"pt-PT","pt-ST":"pt-PT","pt-TL":"pt-PT","zh-Hant-MO":"zh-Hant-HK"};function u(e){var n=[];e=l[e]||e;var t=o[e];t&&n.push(t);for(var r=e.split("-"),a=r.length;1<a;a--)n.push(r.slice(0,a-1).join("-"));return n}function i(e,n){if(e){var t=e.toLowerCase();if(t in n)return n[t].locale||e;var r=l[e];if(r){var a=r.toLowerCase();if(a in n)return n[a].locale||r}for(var o=u(e),i=e;i;)if(i=o.shift()){var s=i.toLowerCase();if(s in n)return n[s].locale||i}}}function s(e,n,t,r,a){var o=e[n];if(void 0===o)return a;if("boolean"!==t&&"string"!==t)throw new TypeError("invalid type");if("boolean"===t&&(o=new Boolean(o)),"string"===t&&(o=new String(o)),void 0!==r&&!r.filter(function(e){return e==o}).length)throw new RangeError(o+" in not within "+r);return o}var p=function(){return(p=Object.assign||function(e){for(var n,t=1,r=arguments.length;t<r;t++)for(var a in n=arguments[t])Object.prototype.hasOwnProperty.call(n,a)&&(e[a]=n[a]);return e}).apply(this,arguments)},b=function(){for(var e=0,n=0,t=arguments.length;n<t;n++)e+=arguments[n].length;var r=Array(e),a=0;for(n=0;n<t;n++)for(var o=arguments[n],i=0,s=o.length;i<s;i++,a++)r[a]=o[i];return r};function d(e,n,t){return"long"==t?e[n]:"narrow"==t&&e[n+"-narrow"]||e[n+"-short"]}function t(e,n){return Object.is?Object.is(e,n):e===n?0!==e||1/e==1/n:e!=e&&n!=n}function g(e){return t(e,-0)?"past":t(e,0)?"future":e<0?"past":"future"}function k(e,n){if(!(e instanceof c))throw new TypeError("Method Intl.RelativeTimeFormat.prototype."+n+" called on incompatible receiver "+String(e))}function y(e){if(!~n.indexOf(e+""))throw new RangeError("Invalid unit argument for format() '"+String(e)+"'");return"s"===e[e.length-1]?e.slice(0,e.length-1):e}function v(e,n){void 0===n&&(n="format");var t="string"==typeof e?new Number(e).valueOf():e;if(!isFinite(t))throw new RangeError("Value need to be finite number for Intl.RelativeTimeFormat.prototype."+n+"()");return t}function w(e){return!!e}var m=(new Intl.NumberFormat).resolvedOptions().locale,c=(h.prototype.format=function(e,n){k(this,"format");var t=y(n),r=v(e),a=this._style,o=this._numeric,i=d(this._fields,t,a);if(!i)throw new Error("Unsupported unit "+n);var s=i.relative,l=i.relativeTime,u="";if("auto"==o&&(u=s[String(r)]||""))return u;var m=this._pl.select(r),c=l[g(r)];return(c[m]||c.other).replace(/\{0\}/,this._nf.format(Math.abs(r)))},h.prototype.formatToParts=function(e,n){k(this,"format");var t=y(n),r=v(e,"formatToParts"),a=this._style,o=this._numeric,i=d(this._fields,t,a);if(!i)throw new Error("Unsupported unit "+n);var s=i.relative,l=i.relativeTime,u="";if("auto"==o&&(u=s[String(r)]||""))return[{type:"literal",value:u}];var m=this._pl.select(r),c=l[g(r)],h=c[m]||c.other,f=this._nf.formatToParts(Math.abs(r)).map(function(e){return p(p({},e),{unit:t})});return h.split(/(\{0\})/).filter(w).reduce(function(e,n){return b(e,"{0}"===n?f:[{type:"literal",value:n}])},[])},h.prototype.resolvedOptions=function(){k(this,"resolvedOptions");var e=Object.create(Object.prototype);return Object.defineProperties(e,{locale:{value:this._nf.resolvedOptions().locale,writable:!0,enumerable:!0,configurable:!0},style:{value:this._style.valueOf(),writable:!0,enumerable:!0,configurable:!0},numeric:{value:this._numeric.valueOf(),writable:!0,enumerable:!0,configurable:!0},numberingSystem:{value:this._numberingSystem.valueOf(),writable:!0,enumerable:!0,configurable:!0}}),e},h.supportedLocalesOf=function(e,n){var t="best fit";if(null===n)throw new TypeError("opts cannot be null");return n&&(t=s(n,"localeMatcher","string",["best fit","lookup"],"best fit")),function(e,n){return(Array.isArray(e)?e:[e]).filter(function(e){return!!i(e,n)})}(Intl.NumberFormat.supportedLocalesOf(e,{localeMatcher:t}),h.__localeData__)},h.__addLocaleData=function(){for(var e=[],n=0;n<arguments.length;n++)e[n]=arguments[n];for(var t=0,r=e;t<r.length;t++){var a=r[t];if(!a||!a.locale)throw new Error("Locale data provided to RelativeTimeFormat is missing a `locale` property value");h.__localeData__[a.locale.toLowerCase()]=a}},h.__localeData__={},h.polyfilled=!0,h);function h(e,n){if(!(this&&this instanceof h?this.constructor:void 0))throw new TypeError("Intl.RelativeTimeFormat must be called with 'new'");var t=void 0===n?Object.create(null):function(e){if(null==e)throw new TypeError("undefined/null cannot be converted to object");return Object(e)}(n),r=void 0===e?[m]:b(Intl.NumberFormat.supportedLocalesOf(e),[m]),a=function(e,n){for(var t=Array.isArray(e)?e:[e],r=0;r<t.length;r++){var a=i(t[r],n);if(a)return a}}(r,h.__localeData__);if(!a)throw new Error("No locale data has been added to IntlRelativeTimeFormat for: "+r.join(", "));this._fields=function(e){var n=c.__localeData__,t=u(e),r=b([e],t).map(function(e){return n[e.toLowerCase()]}).filter(Boolean);if(!r.length)throw new Error("Locale data added to RelativeTimeFormat is missing 'fields' for \""+e+'"');return r.reverse(),r.reduce(function(e,n){return p(p({},e),n.fields)},{})}(a),this._localeMatcher=s(t,"localeMatcher","string",["best fit","lookup"],"best fit"),this._style=s(t,"style","string",["long","narrow","short"],"long"),this._numeric=s(t,"numeric","string",["always","auto"],"always"),this._nf=new Intl.NumberFormat(e),this._pl=new Intl.PluralRules(e),this._numberingSystem=this._nf.resolvedOptions().numberingSystem}try{"undefined"!=typeof Symbol&&Object.defineProperty(c.prototype,Symbol.toStringTag,{value:"Intl.RelativeTimeFormat",writable:!1,enumerable:!1,configurable:!0}),Object.defineProperty(c.prototype.constructor,"length",{value:0,writable:!1,enumerable:!1,configurable:!0}),Object.defineProperty(c.supportedLocalesOf,"length",{value:1,writable:!1,enumerable:!1,configurable:!0})}catch(e){}e.VALID_UNITS=n,e.default=c,Object.defineProperty(e,"__esModule",{value:!0})}); | ||
//# sourceMappingURL=intl-relativetimeformat.min.js.map |
@@ -6,67 +6,2 @@ (function (factory) { | ||
function fixMeta(RelativeTimeFormat) { | ||
if (typeof Intl.RelativeTimeFormat !== 'undefined') { | ||
return; | ||
} | ||
Object.defineProperty(Intl, 'RelativeTimeFormat', { | ||
value: RelativeTimeFormat, | ||
writable: true, | ||
enumerable: false, | ||
configurable: true, | ||
}); | ||
Object.defineProperty(RelativeTimeFormat, 'supportedLocalesOf', { | ||
writable: true, | ||
enumerable: false, | ||
configurable: true, | ||
}); | ||
// IE11 does not have Symbol | ||
if (typeof Symbol !== 'undefined') { | ||
Object.defineProperty(RelativeTimeFormat.prototype, Symbol.toStringTag, { | ||
value: 'Intl.RelativeTimeFormat', | ||
writable: false, | ||
enumerable: false, | ||
configurable: true, | ||
}); | ||
} | ||
Object.defineProperty(RelativeTimeFormat.prototype, 'format', { | ||
writable: true, | ||
enumerable: false, | ||
configurable: true, | ||
}); | ||
Object.defineProperty(RelativeTimeFormat.prototype, 'formatToParts', { | ||
writable: true, | ||
enumerable: false, | ||
configurable: true, | ||
}); | ||
Object.defineProperty(RelativeTimeFormat.prototype, 'resolvedOptions', { | ||
writable: true, | ||
enumerable: false, | ||
configurable: true, | ||
}); | ||
Object.defineProperty(Intl.RelativeTimeFormat, 'prototype', { | ||
writable: false, | ||
enumerable: false, | ||
configurable: false, | ||
}); | ||
try { | ||
// This is bc transpilation process sets class properties to anonymous function | ||
Object.defineProperty(RelativeTimeFormat.prototype.resolvedOptions, 'name', { | ||
value: 'resolvedOptions', | ||
}); | ||
Object.defineProperty(RelativeTimeFormat.prototype.format, 'name', { | ||
value: 'format', | ||
}); | ||
Object.defineProperty(RelativeTimeFormat.prototype.formatToParts, 'name', { | ||
value: 'formatToParts', | ||
}); | ||
Object.defineProperty(RelativeTimeFormat.supportedLocalesOf, 'name', { | ||
value: 'supportedLocalesOf', | ||
}); | ||
} | ||
catch (ex) { | ||
// This crashes due to a bug in JSC on iOS 9. We can safely ignore the error. | ||
// See https://github.com/formatjs/formatjs/issues/128. | ||
} | ||
} | ||
var VALID_UNITS = [ | ||
@@ -299,8 +234,3 @@ 'second', | ||
var RelativeTimeFormat = /** @class */ (function () { | ||
function RelativeTimeFormat() { | ||
var _a = []; | ||
for (var _i = 0; _i < arguments.length; _i++) { | ||
_a[_i] = arguments[_i]; | ||
} | ||
var locales = _a[0], options = _a[1]; | ||
function RelativeTimeFormat(locales, options) { | ||
// test262/test/intl402/RelativeTimeFormat/constructor/constructor/newtarget-undefined.js | ||
@@ -415,4 +345,14 @@ // Cannot use `new.target` bc of IE11 & TS transpiles it to something else | ||
}; | ||
RelativeTimeFormat.prototype.toString = function () { | ||
return '[object Intl.RelativeTimeFormat]'; | ||
RelativeTimeFormat.supportedLocalesOf = function (locales, opts) { | ||
// test262/test/intl402/RelativeTimeFormat/constructor/supportedLocalesOf/options-toobject.js | ||
var localeMatcher = 'best fit'; | ||
// test262/test/intl402/RelativeTimeFormat/constructor/supportedLocalesOf/options-null.js | ||
if (opts === null) { | ||
throw new TypeError('opts cannot be null'); | ||
} | ||
if (opts) { | ||
localeMatcher = getOption(opts, 'localeMatcher', 'string', ['best fit', 'lookup'], 'best fit'); | ||
} | ||
// test262/test/intl402/RelativeTimeFormat/constructor/supportedLocalesOf/result-type.js | ||
return supportedLocalesOf(Intl.NumberFormat.supportedLocalesOf(locales, { localeMatcher: localeMatcher }), RelativeTimeFormat.__localeData__); | ||
}; | ||
@@ -433,20 +373,2 @@ RelativeTimeFormat.__addLocaleData = function () { | ||
}; | ||
RelativeTimeFormat.supportedLocalesOf = function (locales) { | ||
var _a = []; | ||
for (var _i = 1; _i < arguments.length; _i++) { | ||
_a[_i - 1] = arguments[_i]; | ||
} | ||
var opts = _a[0]; | ||
// test262/test/intl402/RelativeTimeFormat/constructor/supportedLocalesOf/options-toobject.js | ||
var localeMatcher = 'best fit'; | ||
// test262/test/intl402/RelativeTimeFormat/constructor/supportedLocalesOf/options-null.js | ||
if (opts === null) { | ||
throw new TypeError('opts cannot be null'); | ||
} | ||
if (opts) { | ||
localeMatcher = getOption(opts, 'localeMatcher', 'string', ['best fit', 'lookup'], 'best fit'); | ||
} | ||
// test262/test/intl402/RelativeTimeFormat/constructor/supportedLocalesOf/result-type.js | ||
return supportedLocalesOf(Intl.NumberFormat.supportedLocalesOf(locales, { localeMatcher: localeMatcher }), RelativeTimeFormat.__localeData__); | ||
}; | ||
RelativeTimeFormat.__localeData__ = {}; | ||
@@ -456,6 +378,41 @@ RelativeTimeFormat.polyfilled = true; | ||
}()); | ||
try { | ||
// IE11 does not have Symbol | ||
if (typeof Symbol !== 'undefined') { | ||
Object.defineProperty(RelativeTimeFormat.prototype, Symbol.toStringTag, { | ||
value: 'Intl.RelativeTimeFormat', | ||
writable: false, | ||
enumerable: false, | ||
configurable: true, | ||
}); | ||
} | ||
// https://github.com/tc39/test262/blob/master/test/intl402/RelativeTimeFormat/constructor/length.js | ||
Object.defineProperty(RelativeTimeFormat.prototype.constructor, 'length', { | ||
value: 0, | ||
writable: false, | ||
enumerable: false, | ||
configurable: true, | ||
}); | ||
// https://github.com/tc39/test262/blob/master/test/intl402/RelativeTimeFormat/constructor/supportedLocalesOf/length.js | ||
Object.defineProperty(RelativeTimeFormat.supportedLocalesOf, 'length', { | ||
value: 1, | ||
writable: false, | ||
enumerable: false, | ||
configurable: true, | ||
}); | ||
} | ||
catch (e) { | ||
// Meta fix so we're test262-compliant, not important | ||
} | ||
fixMeta(RelativeTimeFormat); | ||
if (!('RelativeTimeFormat' in Intl)) { | ||
Object.defineProperty(Intl, 'RelativeTimeFormat', { | ||
value: RelativeTimeFormat, | ||
writable: true, | ||
enumerable: false, | ||
configurable: true, | ||
}); | ||
} | ||
})); | ||
//# sourceMappingURL=polyfill-intl-relativetimeformat.js.map |
@@ -59,8 +59,7 @@ import { FormattableUnit } from './types'; | ||
private readonly _numberingSystem; | ||
constructor(...[locales, options]: [string | string[] | undefined, IntlRelativeTimeFormatOptions | undefined]); | ||
constructor(locales?: string | string[], options?: IntlRelativeTimeFormatOptions); | ||
format(value: number | string, unit: FormattableUnit): string; | ||
formatToParts(value: number | string, unit: FormattableUnit): Part[]; | ||
resolvedOptions(): ResolvedIntlRelativeTimeFormatOptions; | ||
toString(): string; | ||
static supportedLocalesOf: (locales: string | string[], __1_0: Pick<IntlRelativeTimeFormatOptions, "localeMatcher"> | undefined) => (string | undefined)[]; | ||
static supportedLocalesOf(locales: string | string[], opts?: Pick<IntlRelativeTimeFormatOptions, 'localeMatcher'>): (string | undefined)[]; | ||
static __localeData__: Record<string, RelativeTimeLocaleData>; | ||
@@ -67,0 +66,0 @@ static __addLocaleData(...data: RelativeTimeLocaleData[]): void; |
@@ -97,8 +97,3 @@ var __assign = (this && this.__assign) || function () { | ||
var RelativeTimeFormat = /** @class */ (function () { | ||
function RelativeTimeFormat() { | ||
var _a = []; | ||
for (var _i = 0; _i < arguments.length; _i++) { | ||
_a[_i] = arguments[_i]; | ||
} | ||
var locales = _a[0], options = _a[1]; | ||
function RelativeTimeFormat(locales, options) { | ||
// test262/test/intl402/RelativeTimeFormat/constructor/constructor/newtarget-undefined.js | ||
@@ -213,4 +208,14 @@ // Cannot use `new.target` bc of IE11 & TS transpiles it to something else | ||
}; | ||
RelativeTimeFormat.prototype.toString = function () { | ||
return '[object Intl.RelativeTimeFormat]'; | ||
RelativeTimeFormat.supportedLocalesOf = function (locales, opts) { | ||
// test262/test/intl402/RelativeTimeFormat/constructor/supportedLocalesOf/options-toobject.js | ||
var localeMatcher = 'best fit'; | ||
// test262/test/intl402/RelativeTimeFormat/constructor/supportedLocalesOf/options-null.js | ||
if (opts === null) { | ||
throw new TypeError('opts cannot be null'); | ||
} | ||
if (opts) { | ||
localeMatcher = getOption(opts, 'localeMatcher', 'string', ['best fit', 'lookup'], 'best fit'); | ||
} | ||
// test262/test/intl402/RelativeTimeFormat/constructor/supportedLocalesOf/result-type.js | ||
return supportedLocalesOf(Intl.NumberFormat.supportedLocalesOf(locales, { localeMatcher: localeMatcher }), RelativeTimeFormat.__localeData__); | ||
}; | ||
@@ -231,20 +236,2 @@ RelativeTimeFormat.__addLocaleData = function () { | ||
}; | ||
RelativeTimeFormat.supportedLocalesOf = function (locales) { | ||
var _a = []; | ||
for (var _i = 1; _i < arguments.length; _i++) { | ||
_a[_i - 1] = arguments[_i]; | ||
} | ||
var opts = _a[0]; | ||
// test262/test/intl402/RelativeTimeFormat/constructor/supportedLocalesOf/options-toobject.js | ||
var localeMatcher = 'best fit'; | ||
// test262/test/intl402/RelativeTimeFormat/constructor/supportedLocalesOf/options-null.js | ||
if (opts === null) { | ||
throw new TypeError('opts cannot be null'); | ||
} | ||
if (opts) { | ||
localeMatcher = getOption(opts, 'localeMatcher', 'string', ['best fit', 'lookup'], 'best fit'); | ||
} | ||
// test262/test/intl402/RelativeTimeFormat/constructor/supportedLocalesOf/result-type.js | ||
return supportedLocalesOf(Intl.NumberFormat.supportedLocalesOf(locales, { localeMatcher: localeMatcher }), RelativeTimeFormat.__localeData__); | ||
}; | ||
RelativeTimeFormat.__localeData__ = {}; | ||
@@ -255,1 +242,29 @@ RelativeTimeFormat.polyfilled = true; | ||
export default RelativeTimeFormat; | ||
try { | ||
// IE11 does not have Symbol | ||
if (typeof Symbol !== 'undefined') { | ||
Object.defineProperty(RelativeTimeFormat.prototype, Symbol.toStringTag, { | ||
value: 'Intl.RelativeTimeFormat', | ||
writable: false, | ||
enumerable: false, | ||
configurable: true, | ||
}); | ||
} | ||
// https://github.com/tc39/test262/blob/master/test/intl402/RelativeTimeFormat/constructor/length.js | ||
Object.defineProperty(RelativeTimeFormat.prototype.constructor, 'length', { | ||
value: 0, | ||
writable: false, | ||
enumerable: false, | ||
configurable: true, | ||
}); | ||
// https://github.com/tc39/test262/blob/master/test/intl402/RelativeTimeFormat/constructor/supportedLocalesOf/length.js | ||
Object.defineProperty(RelativeTimeFormat.supportedLocalesOf, 'length', { | ||
value: 1, | ||
writable: false, | ||
enumerable: false, | ||
configurable: true, | ||
}); | ||
} | ||
catch (e) { | ||
// Meta fix so we're test262-compliant, not important | ||
} |
@@ -1,1 +0,2 @@ | ||
export {}; | ||
import './polyfill'; | ||
import './locales'; |
@@ -1,3 +0,2 @@ | ||
import fixMeta from './fix-meta'; | ||
import IntlRelativeTimeFormat from './locales'; | ||
fixMeta(IntlRelativeTimeFormat); | ||
import './polyfill'; | ||
import './locales'; |
@@ -1,3 +0,9 @@ | ||
import fixMeta from './fix-meta'; | ||
import IntlRelativeTimeFormat from './'; | ||
fixMeta(IntlRelativeTimeFormat); | ||
import RelativeTimeFormat from './core'; | ||
if (!('RelativeTimeFormat' in Intl)) { | ||
Object.defineProperty(Intl, 'RelativeTimeFormat', { | ||
value: RelativeTimeFormat, | ||
writable: true, | ||
enumerable: false, | ||
configurable: true, | ||
}); | ||
} |
{ | ||
"name": "@formatjs/intl-relativetimeformat", | ||
"version": "4.0.0", | ||
"version": "4.0.1", | ||
"description": "Formats JavaScript dates to relative time strings.", | ||
@@ -23,3 +23,3 @@ "keywords": [ | ||
"devDependencies": { | ||
"@formatjs/intl-pluralrules": "^1.1.4", | ||
"@formatjs/intl-pluralrules": "^1.1.5", | ||
"formatjs-extract-cldr-data": "^9.7.1" | ||
@@ -37,3 +37,3 @@ }, | ||
"clean": "rimraf dist lib", | ||
"compile": "tsc && tsc -p tsconfig.cjs.json && rollup -c rollup.config.js", | ||
"compile": "tsc && tsc -p tsconfig.cjs.json && tsc -p tsconfig.es6.json && rollup -c rollup.config.js", | ||
"jest": "cross-env NODE_ICU_DATA=../../node_modules/full-icu TS_NODE_PROJECT=tsconfig.cjs.json cross-env NODE_ENV=test jest", | ||
@@ -44,3 +44,3 @@ "test": "npm run jest && cross-env NODE_ICU_DATA=../../node_modules/full-icu TS_NODE_PROJECT=tsconfig.cjs.json ts-node tests/runner" | ||
"license": "MIT", | ||
"gitHead": "7e0eccfc4278e044a7ea583468844ab8295aedf7" | ||
"gitHead": "f275221512d2d7e8af4a10a0230a505922fcaf31" | ||
} |
@@ -185,6 +185,4 @@ import {Unit, FormattableUnit, VALID_UNITS} from './types'; | ||
constructor( | ||
...[locales, options]: [ | ||
string | string[] | undefined, | ||
IntlRelativeTimeFormatOptions | undefined | ||
] | ||
locales?: string | string[], | ||
options?: IntlRelativeTimeFormatOptions | ||
) { | ||
@@ -345,12 +343,6 @@ // test262/test/intl402/RelativeTimeFormat/constructor/constructor/newtarget-undefined.js | ||
toString() { | ||
return '[object Intl.RelativeTimeFormat]'; | ||
} | ||
public static supportedLocalesOf = ( | ||
public static supportedLocalesOf( | ||
locales: string | string[], | ||
...[opts]: [ | ||
Pick<IntlRelativeTimeFormatOptions, 'localeMatcher'> | undefined | ||
] | ||
) => { | ||
opts?: Pick<IntlRelativeTimeFormatOptions, 'localeMatcher'> | ||
) { | ||
// test262/test/intl402/RelativeTimeFormat/constructor/supportedLocalesOf/options-toobject.js | ||
@@ -377,3 +369,3 @@ let localeMatcher: IntlRelativeTimeFormatOptions['localeMatcher'] = | ||
); | ||
}; | ||
} | ||
@@ -395,1 +387,30 @@ static __localeData__: Record<string, RelativeTimeLocaleData> = {}; | ||
} | ||
try { | ||
// IE11 does not have Symbol | ||
if (typeof Symbol !== 'undefined') { | ||
Object.defineProperty(RelativeTimeFormat.prototype, Symbol.toStringTag, { | ||
value: 'Intl.RelativeTimeFormat', | ||
writable: false, | ||
enumerable: false, | ||
configurable: true, | ||
}); | ||
} | ||
// https://github.com/tc39/test262/blob/master/test/intl402/RelativeTimeFormat/constructor/length.js | ||
Object.defineProperty(RelativeTimeFormat.prototype.constructor, 'length', { | ||
value: 0, | ||
writable: false, | ||
enumerable: false, | ||
configurable: true, | ||
}); | ||
// https://github.com/tc39/test262/blob/master/test/intl402/RelativeTimeFormat/constructor/supportedLocalesOf/length.js | ||
Object.defineProperty(RelativeTimeFormat.supportedLocalesOf, 'length', { | ||
value: 1, | ||
writable: false, | ||
enumerable: false, | ||
configurable: true, | ||
}); | ||
} catch (e) { | ||
// Meta fix so we're test262-compliant, not important | ||
} |
@@ -1,3 +0,2 @@ | ||
import fixMeta from './fix-meta'; | ||
import IntlRelativeTimeFormat from './locales'; | ||
fixMeta(IntlRelativeTimeFormat); | ||
import './polyfill'; | ||
import './locales'; |
@@ -1,3 +0,9 @@ | ||
import fixMeta from './fix-meta'; | ||
import IntlRelativeTimeFormat from './'; | ||
fixMeta(IntlRelativeTimeFormat); | ||
import RelativeTimeFormat from './core'; | ||
if (!('RelativeTimeFormat' in Intl)) { | ||
Object.defineProperty(Intl, 'RelativeTimeFormat', { | ||
value: RelativeTimeFormat, | ||
writable: true, | ||
enumerable: false, | ||
configurable: true, | ||
}); | ||
} |
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 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 not supported yet
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
23222495
279
46279