import { getSetting } from './settings.js'; /* Babel polyfill for SimpleSchema. See https://github.com/aldeed/node-simple-schema/issues/33 */ Array.includes = function() { let [first, ...rest] = arguments; return Array.prototype.includes.apply(first, rest); } /* intl polyfill. See https://github.com/andyearnshaw/Intl.js/ */ const areIntlLocalesSupported = require('intl-locales-supported'); const localesMyAppSupports = [ getSetting("locale", "en") ]; if (global.Intl) { // Determine if the built-in `Intl` has the locale data we need. if (!areIntlLocalesSupported(localesMyAppSupports)) { // `Intl` exists, but it doesn't have the data we need, so load the // polyfill and replace the constructors with need with the polyfill's. const IntlPolyfill = require('intl'); Intl.NumberFormat = IntlPolyfill.NumberFormat; Intl.DateTimeFormat = IntlPolyfill.DateTimeFormat; } } else { // No `Intl`, so use and load the polyfill. global.Intl = require('intl'); }