Why Gemfury? Push, build, and install  RubyGems npm packages Python packages Maven artifacts PHP packages Go Modules Debian packages RPM packages NuGet packages

Repository URL to install this package:

Details    
@doodle/i18n / dist / import.js
Size: Mime:
"use strict";

var _interopRequireDefault = require("@babel/runtime/helpers/interopRequireDefault");

Object.defineProperty(exports, "__esModule", {
  value: true
});
exports.extractIntlLocaleData = extractIntlLocaleData;
exports.importIntl = importIntl;

var _interopRequireWildcard2 = _interopRequireDefault(require("@babel/runtime/helpers/interopRequireWildcard"));

var _utils = require("./utils");

function extractIntlLocaleData(reactIntlLocaleData, locale) {
  const normalizedLocale = (0, _utils.normalizeLocale)(locale);
  const [language] = normalizedLocale.split('-'); // react-intl's locale data provides additional specific locales, i.e. `en-GB`: we'll pick the base locale data

  const [specificLocaleData] = reactIntlLocaleData.default.filter(localeData => localeData.locale === normalizedLocale);
  const defaultLocaleData = reactIntlLocaleData.default.filter(localeData => localeData.locale === language);
  return specificLocaleData || defaultLocaleData;
}
/**
 * Dynamic import of the `Intl` polyfill, but only if there is no support
 */


async function importIntl() {
  if (!global.Intl) {
    await Promise.resolve().then(() => (0, _interopRequireWildcard2.default)(require('intl')));
  }
}
//# sourceMappingURL=import.js.map