@formatjs/intl-supportedvaluesof 3.1.0 → 3.1.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/index.js +55 -2
- package/index.js.map +1 -1
- package/package.json +2 -2
- package/polyfill-force.js +56 -2
- package/polyfill-force.js.map +1 -1
- package/polyfill.iife.js +82 -8
- package/polyfill.js +56 -2
- package/polyfill.js.map +1 -1
package/polyfill.iife.js
CHANGED
|
@@ -3,14 +3,23 @@ function shouldPolyfill() {
|
|
|
3
3
|
return typeof Intl === "undefined" || !("supportedValuesOf" in Intl);
|
|
4
4
|
}
|
|
5
5
|
// packages/ecma262-abstract/ToString.js
|
|
6
|
+
const StringConstructor = String;
|
|
7
|
+
const TypeErrorConstructor = TypeError;
|
|
6
8
|
/**
|
|
7
9
|
* https://tc39.es/ecma262/#sec-tostring
|
|
8
10
|
*/
|
|
9
11
|
function ToString(o) {
|
|
10
|
-
if (typeof o === "symbol") throw
|
|
11
|
-
return
|
|
12
|
+
if (typeof o === "symbol") throw TypeErrorConstructor("Cannot convert a Symbol value to a string");
|
|
13
|
+
return StringConstructor(o);
|
|
12
14
|
}
|
|
13
15
|
// node_modules/.aspect_rules_js/@formatjs+fast-memoize@0.0.0/node_modules/@formatjs/fast-memoize/index.js
|
|
16
|
+
const apply = Reflect.apply;
|
|
17
|
+
const bind = Function.prototype.bind;
|
|
18
|
+
const slice = Array.prototype.slice;
|
|
19
|
+
const stringify = JSON.stringify;
|
|
20
|
+
const create = Object.create;
|
|
21
|
+
const defineProperty$1 = Object.defineProperty;
|
|
22
|
+
const setPrototypeOf = Object.setPrototypeOf;
|
|
14
23
|
function memoize(fn, options) {
|
|
15
24
|
const cache = options && options.cache ? options.cache : cacheDefault;
|
|
16
25
|
const serializer = options && options.serializer ? options.serializer : serializerDefault;
|
|
@@ -26,23 +35,29 @@ function monadic(fn, cache, serializer, arg) {
|
|
|
26
35
|
const cacheKey = isPrimitive(arg) ? arg : serializer(arg);
|
|
27
36
|
let computedValue = cache.get(cacheKey);
|
|
28
37
|
if (typeof computedValue === "undefined") {
|
|
29
|
-
computedValue = fn
|
|
38
|
+
computedValue = apply(fn, this, [arg]);
|
|
30
39
|
cache.set(cacheKey, computedValue);
|
|
31
40
|
}
|
|
32
41
|
return computedValue;
|
|
33
42
|
}
|
|
34
43
|
function variadic(fn, cache, serializer) {
|
|
35
|
-
const args =
|
|
44
|
+
const args = apply(slice, arguments, [3]);
|
|
45
|
+
if (serializer === serializerDefault) setPrototypeOf(args, null);
|
|
36
46
|
const cacheKey = serializer(args);
|
|
37
47
|
let computedValue = cache.get(cacheKey);
|
|
38
48
|
if (typeof computedValue === "undefined") {
|
|
39
|
-
computedValue =
|
|
49
|
+
computedValue = apply(fn, this, args);
|
|
40
50
|
cache.set(cacheKey, computedValue);
|
|
41
51
|
}
|
|
42
52
|
return computedValue;
|
|
43
53
|
}
|
|
44
54
|
function assemble(fn, context, strategy, cache, serialize) {
|
|
45
|
-
return
|
|
55
|
+
return apply(bind, strategy, [
|
|
56
|
+
context,
|
|
57
|
+
fn,
|
|
58
|
+
cache,
|
|
59
|
+
serialize
|
|
60
|
+
]);
|
|
46
61
|
}
|
|
47
62
|
function strategyDefault(fn, options) {
|
|
48
63
|
const strategy = fn.length === 1 ? monadic : variadic;
|
|
@@ -55,11 +70,18 @@ function strategyMonadic(fn, options) {
|
|
|
55
70
|
return assemble(fn, this, monadic, options.cache.create(), options.serializer);
|
|
56
71
|
}
|
|
57
72
|
const serializerDefault = function() {
|
|
58
|
-
|
|
73
|
+
setPrototypeOf(arguments, null);
|
|
74
|
+
return stringify(arguments);
|
|
59
75
|
};
|
|
60
76
|
var ObjectWithoutPrototypeCache = class {
|
|
61
77
|
constructor() {
|
|
62
|
-
this
|
|
78
|
+
defineProperty$1(this, "cache", {
|
|
79
|
+
__proto__: null,
|
|
80
|
+
value: create(null),
|
|
81
|
+
writable: true,
|
|
82
|
+
enumerable: true,
|
|
83
|
+
configurable: true
|
|
84
|
+
});
|
|
63
85
|
}
|
|
64
86
|
get(key) {
|
|
65
87
|
return this.cache[key];
|
|
@@ -461,6 +483,13 @@ function isSupportedCollation(collation) {
|
|
|
461
483
|
function getSupportedCollations() {
|
|
462
484
|
return collations.filter(isSupportedCollation).sort();
|
|
463
485
|
}
|
|
486
|
+
Number.isInteger;
|
|
487
|
+
Number.isFinite;
|
|
488
|
+
Number.isSafeInteger;
|
|
489
|
+
Array.prototype.every;
|
|
490
|
+
Array.prototype.some;
|
|
491
|
+
Array.prototype.includes;
|
|
492
|
+
Array.prototype.indexOf;
|
|
464
493
|
// packages/ecma402-abstract/utils.js
|
|
465
494
|
function defineProperty(target, name, { value }) {
|
|
466
495
|
Object.defineProperty(target, name, {
|
|
@@ -477,11 +506,56 @@ function ensureIntl() {
|
|
|
477
506
|
writable: true,
|
|
478
507
|
value: {}
|
|
479
508
|
});
|
|
509
|
+
if (providerIntl === void 0) providerIntl = Intl;
|
|
480
510
|
return Intl;
|
|
481
511
|
}
|
|
482
512
|
const createMemoizedNumberFormat = memoize((...args) => new Intl.NumberFormat(...args), { strategy: strategies.variadic });
|
|
483
513
|
memoize((...args) => new Intl.PluralRules(...args), { strategy: strategies.variadic });
|
|
484
514
|
memoize((...args) => new Intl.ListFormat(...args), { strategy: strategies.variadic });
|
|
515
|
+
const getOwnPropertyDescriptor = Object.getOwnPropertyDescriptor;
|
|
516
|
+
strategies.variadic;
|
|
517
|
+
let providerIntl = globalThis.Intl;
|
|
518
|
+
function ownIntlProvider(name) {
|
|
519
|
+
const descriptor = providerIntl && getOwnPropertyDescriptor(providerIntl, name);
|
|
520
|
+
return (descriptor && getOwnPropertyDescriptor(descriptor, "value"))?.value;
|
|
521
|
+
}
|
|
522
|
+
let numberFormatProvider = ownIntlProvider("NumberFormat");
|
|
523
|
+
let listFormatProvider = ownIntlProvider("ListFormat");
|
|
524
|
+
const getFormatterPrototype = Object.getPrototypeOf;
|
|
525
|
+
const formatterPartsMethods = /* @__PURE__ */ new WeakMap();
|
|
526
|
+
const formatterPartsOwners = /* @__PURE__ */ new WeakMap();
|
|
527
|
+
const getPartsMethod = formatterPartsMethods.get.bind(formatterPartsMethods);
|
|
528
|
+
const setPartsMethod = formatterPartsMethods.set.bind(formatterPartsMethods);
|
|
529
|
+
const getPartsOwner = formatterPartsOwners.get.bind(formatterPartsOwners);
|
|
530
|
+
const setPartsOwner = formatterPartsOwners.set.bind(formatterPartsOwners);
|
|
531
|
+
function findFormatterPartsMethod(Constructor) {
|
|
532
|
+
const cached = getPartsMethod(Constructor);
|
|
533
|
+
if (cached) return cached;
|
|
534
|
+
let prototype = getOwnPropertyDescriptor(Constructor, "prototype")?.value;
|
|
535
|
+
while (prototype != null) {
|
|
536
|
+
const inherited = getPartsOwner(prototype);
|
|
537
|
+
if (inherited) {
|
|
538
|
+
setPartsMethod(Constructor, inherited);
|
|
539
|
+
return inherited;
|
|
540
|
+
}
|
|
541
|
+
const descriptor = getOwnPropertyDescriptor(prototype, "formatToParts");
|
|
542
|
+
const value = descriptor && getOwnPropertyDescriptor(descriptor, "value");
|
|
543
|
+
if (value && typeof value.value === "function") {
|
|
544
|
+
setPartsMethod(Constructor, value.value);
|
|
545
|
+
setPartsOwner(prototype, value.value);
|
|
546
|
+
return value.value;
|
|
547
|
+
}
|
|
548
|
+
prototype = getFormatterPrototype(prototype);
|
|
549
|
+
}
|
|
550
|
+
}
|
|
551
|
+
if (typeof numberFormatProvider === "function") findFormatterPartsMethod(numberFormatProvider);
|
|
552
|
+
if (typeof listFormatProvider === "function") findFormatterPartsMethod(listFormatProvider);
|
|
553
|
+
const numberFormatMemoizers = /* @__PURE__ */ new WeakMap();
|
|
554
|
+
numberFormatMemoizers.get.bind(numberFormatMemoizers);
|
|
555
|
+
numberFormatMemoizers.set.bind(numberFormatMemoizers);
|
|
556
|
+
const listFormatMemoizers = /* @__PURE__ */ new WeakMap();
|
|
557
|
+
listFormatMemoizers.get.bind(listFormatMemoizers);
|
|
558
|
+
listFormatMemoizers.set.bind(listFormatMemoizers);
|
|
485
559
|
// node_modules/.aspect_rules_js/@formatjs_generated+cldr.supported-values@0.0.0/node_modules/@formatjs_generated/cldr.supported-values/currencies.js
|
|
486
560
|
const currencies = [
|
|
487
561
|
"ADP",
|
package/polyfill.js
CHANGED
|
@@ -4,12 +4,14 @@ function shouldPolyfill() {
|
|
|
4
4
|
return typeof Intl === "undefined" || !("supportedValuesOf" in Intl);
|
|
5
5
|
}
|
|
6
6
|
// packages/ecma262-abstract/ToString.js
|
|
7
|
+
const StringConstructor = String;
|
|
8
|
+
const TypeErrorConstructor = TypeError;
|
|
7
9
|
/**
|
|
8
10
|
* https://tc39.es/ecma262/#sec-tostring
|
|
9
11
|
*/
|
|
10
12
|
function ToString(o) {
|
|
11
|
-
if (typeof o === "symbol") throw
|
|
12
|
-
return
|
|
13
|
+
if (typeof o === "symbol") throw TypeErrorConstructor("Cannot convert a Symbol value to a string");
|
|
14
|
+
return StringConstructor(o);
|
|
13
15
|
}
|
|
14
16
|
// packages/intl-supportedvaluesof/memoize.ts
|
|
15
17
|
/**
|
|
@@ -397,6 +399,13 @@ function isSupportedCollation(collation) {
|
|
|
397
399
|
function getSupportedCollations() {
|
|
398
400
|
return collations.filter(isSupportedCollation).sort();
|
|
399
401
|
}
|
|
402
|
+
Number.isInteger;
|
|
403
|
+
Number.isFinite;
|
|
404
|
+
Number.isSafeInteger;
|
|
405
|
+
Array.prototype.every;
|
|
406
|
+
Array.prototype.some;
|
|
407
|
+
Array.prototype.includes;
|
|
408
|
+
Array.prototype.indexOf;
|
|
400
409
|
// packages/ecma402-abstract/utils.js
|
|
401
410
|
function defineProperty(target, name, { value }) {
|
|
402
411
|
Object.defineProperty(target, name, {
|
|
@@ -413,11 +422,56 @@ function ensureIntl() {
|
|
|
413
422
|
writable: true,
|
|
414
423
|
value: {}
|
|
415
424
|
});
|
|
425
|
+
if (providerIntl === void 0) providerIntl = Intl;
|
|
416
426
|
return Intl;
|
|
417
427
|
}
|
|
418
428
|
const createMemoizedNumberFormat = memoize((...args) => new Intl.NumberFormat(...args), { strategy: strategies.variadic });
|
|
419
429
|
memoize((...args) => new Intl.PluralRules(...args), { strategy: strategies.variadic });
|
|
420
430
|
memoize((...args) => new Intl.ListFormat(...args), { strategy: strategies.variadic });
|
|
431
|
+
const getOwnPropertyDescriptor = Object.getOwnPropertyDescriptor;
|
|
432
|
+
strategies.variadic;
|
|
433
|
+
let providerIntl = globalThis.Intl;
|
|
434
|
+
function ownIntlProvider(name) {
|
|
435
|
+
const descriptor = providerIntl && getOwnPropertyDescriptor(providerIntl, name);
|
|
436
|
+
return (descriptor && getOwnPropertyDescriptor(descriptor, "value"))?.value;
|
|
437
|
+
}
|
|
438
|
+
let numberFormatProvider = ownIntlProvider("NumberFormat");
|
|
439
|
+
let listFormatProvider = ownIntlProvider("ListFormat");
|
|
440
|
+
const getFormatterPrototype = Object.getPrototypeOf;
|
|
441
|
+
const formatterPartsMethods = /* @__PURE__ */ new WeakMap();
|
|
442
|
+
const formatterPartsOwners = /* @__PURE__ */ new WeakMap();
|
|
443
|
+
const getPartsMethod = formatterPartsMethods.get.bind(formatterPartsMethods);
|
|
444
|
+
const setPartsMethod = formatterPartsMethods.set.bind(formatterPartsMethods);
|
|
445
|
+
const getPartsOwner = formatterPartsOwners.get.bind(formatterPartsOwners);
|
|
446
|
+
const setPartsOwner = formatterPartsOwners.set.bind(formatterPartsOwners);
|
|
447
|
+
function findFormatterPartsMethod(Constructor) {
|
|
448
|
+
const cached = getPartsMethod(Constructor);
|
|
449
|
+
if (cached) return cached;
|
|
450
|
+
let prototype = getOwnPropertyDescriptor(Constructor, "prototype")?.value;
|
|
451
|
+
while (prototype != null) {
|
|
452
|
+
const inherited = getPartsOwner(prototype);
|
|
453
|
+
if (inherited) {
|
|
454
|
+
setPartsMethod(Constructor, inherited);
|
|
455
|
+
return inherited;
|
|
456
|
+
}
|
|
457
|
+
const descriptor = getOwnPropertyDescriptor(prototype, "formatToParts");
|
|
458
|
+
const value = descriptor && getOwnPropertyDescriptor(descriptor, "value");
|
|
459
|
+
if (value && typeof value.value === "function") {
|
|
460
|
+
setPartsMethod(Constructor, value.value);
|
|
461
|
+
setPartsOwner(prototype, value.value);
|
|
462
|
+
return value.value;
|
|
463
|
+
}
|
|
464
|
+
prototype = getFormatterPrototype(prototype);
|
|
465
|
+
}
|
|
466
|
+
}
|
|
467
|
+
if (typeof numberFormatProvider === "function") findFormatterPartsMethod(numberFormatProvider);
|
|
468
|
+
if (typeof listFormatProvider === "function") findFormatterPartsMethod(listFormatProvider);
|
|
469
|
+
const numberFormatMemoizers = /* @__PURE__ */ new WeakMap();
|
|
470
|
+
numberFormatMemoizers.get.bind(numberFormatMemoizers);
|
|
471
|
+
numberFormatMemoizers.set.bind(numberFormatMemoizers);
|
|
472
|
+
const listFormatMemoizers = /* @__PURE__ */ new WeakMap();
|
|
473
|
+
listFormatMemoizers.get.bind(listFormatMemoizers);
|
|
474
|
+
listFormatMemoizers.set.bind(listFormatMemoizers);
|
|
421
475
|
// node_modules/.aspect_rules_js/@formatjs_generated+cldr.supported-values@0.0.0/node_modules/@formatjs_generated/cldr.supported-values/currencies.js
|
|
422
476
|
const currencies = [
|
|
423
477
|
"ADP",
|