A polyfill/ponyfill for Intl.supportedValuesOf.
Installation#
npm i @formatjs/intl-supportedvaluesof
Requirements#
Usage#
Simple#
import '@formatjs/intl-supportedvaluesof/polyfill.js'
Dynamic import + capability detection#
async function polyfill() {
// This platform already supports Intl.supportedValuesOf
if (shouldPolyfill()) {
await import('@formatjs/intl-supportedvaluesof/polyfill.js')
}
// Alternatively, force the polyfill regardless of support
await import('@formatjs/intl-supportedvaluesof/polyfill-force.js')
}
Tests#
The Bazel :test262 target runs the upstream suite against a reviewed failure baseline. A green baseline check does not mean every test passed. See the conformance report; run bazel test //packages/intl-supportedvaluesof:test262-strict to require zero failures.
Key coercion#
Intl.supportedValuesOf converts its key to a string before validating the
category. String wrapper objects are accepted; Symbols throw TypeError.
Intl.supportedValuesOf is callable but cannot be used as a constructor.
Time-zone candidates include the pinned IANA etcetera Zone records and UTC,
in addition to continental transition zones. Runtime filtering retains primary
identifiers and omits aliases such as Etc/UTC.
Collation enumeration probes CLDR-derived candidate locales for each type,
including locale-specific collations such as German phonebk and Spanish trad.
Only collations accepted by the installed Collator are returned.