Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
feat(@formatjs/intl-getcanonicallocales): expose shouldPolyfill to de…
…tect if platform needs our polyfill
- Loading branch information
Showing
3 changed files
with
17 additions
and
13 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,10 @@ | ||
export function shouldPolyfill() { | ||
return ( | ||
typeof Intl === 'undefined' || | ||
!('getCanonicalLocales' in Intl) || | ||
// Native Intl.getCanonicalLocales is just buggy | ||
// https://bugs.chromium.org/p/v8/issues/detail?id=10682 | ||
((Intl as any).getCanonicalLocales as any)('und-x-private')[0] === | ||
'x-private' | ||
); | ||
} |