intl
Version:
Polyfill the ECMA-402 Intl API (except collation)
16 lines (12 loc) • 574 B
JavaScript
// Expose `IntlPolyfill` as global to add locale data into runtime later on.
global.IntlPolyfill = require('./lib/core.js');
// Require all locale data for `Intl`. This module will be
// ignored when bundling for the browser with Browserify/Webpack.
require('./locale-data/complete.js');
// hack to export the polyfill as global Intl if needed
if (!global.Intl) {
global.Intl = global.IntlPolyfill;
global.IntlPolyfill.__applyLocaleSensitivePrototypes();
}
// providing an idiomatic api for the nodejs version of this module
module.exports = global.IntlPolyfill;