MCPcopy
hub / github.com/formatjs/formatjs / ensureIntl

Function ensureIntl

packages/intl-collator/core.ts:38–52  ·  view source on GitHub ↗
()

Source from the content-addressed store, hash-verified

36// need a safe Intl object before they define Intl.Collator.
37// https://tc39.es/ecma402/#sec-intl.collator
38function ensureIntl() {
39 if (typeof Intl === 'undefined') {
40 if (typeof window !== 'undefined') {
41 Object.defineProperty(window, 'Intl', {
42 value: {},
43 })
44 // @ts-ignore we don't include @types/node so global isn't a thing
45 } else if (typeof global !== 'undefined') {
46 // @ts-ignore we don't include @types/node so global isn't a thing
47 Object.defineProperty(global, 'Intl', {
48 value: {},
49 })
50 }
51 }
52}
53
54export const Collator = function (
55 this: CollatorType,

Callers 15

polyfill-force.tsFile · 0.70
polyfill.tsFile · 0.70
core.tsFile · 0.70
polyfill-force.tsFile · 0.50
polyfill.tsFile · 0.50
polyfill-force.tsFile · 0.50
polyfill.tsFile · 0.50
polyfill-force.tsFile · 0.50
polyfill.tsFile · 0.50
polyfill-force.tsFile · 0.50
polyfill.tsFile · 0.50
polyfill-force.tsFile · 0.50

Calls

no outgoing calls

Tested by

no test coverage detected