dist/index-cjs.js
function IMFClass(opts) {
  if (!(this instanceof IMFClass)) {
    return new IMFClass(opts);
  }

  opts = opts || {};
  this.defaultNamespace = opts.defaultNamespace || '';
  this.defaultSeparator = opts.defaultSeparator === undefined ? '.' : opts.defaultSeparator;
  this.basePath = opts.basePath || 'locales/';
  this.fallbackLanguages = opts.fallbackLanguages;

  this.localeFileResolver = opts.localeFileResolver || function (lang) {
    return this.basePath + lang + '.json';
  };

  this.locales = opts.locales || [];
  this.langs = opts.langs;
  this.fallbackLocales = opts.fallbackLocales || [];

  const loadFallbacks = cb => {
    this.loadLocales(this.fallbackLanguages, function (...fallbackLocales) {
      this.fallbackLocales.push(...fallbackLocales);

      if (cb) {
        return cb(fallbackLocales);
      }
    }, true);
  };

  if (opts.languages || opts.callback) {
    this.loadLocales(opts.languages, () => {
      const locales = Array.from(arguments);

      const runCallback = fallbackLocales => {
        if (opts.callback) {
          opts.callback.apply(this, [this.getFormatter(opts.namespace), this.getFormatter.bind(this), locales, fallbackLocales]);
        }
      };

      if (opts.hasOwnProperty('fallbackLanguages')) {
        loadFallbacks(runCallback);
      } else {
        runCallback();
      }
    });
  } else if (opts.hasOwnProperty('fallbackLanguages')) {
    loadFallbacks();
  }
}
function IMFClass(opts) {
  if (!(this instanceof IMFClass)) {
    return new IMFClass(opts);
  }

  opts = opts || {};
  this.defaultNamespace = opts.defaultNamespace || '';
  this.defaultSeparator = opts.defaultSeparator === undefined ? '.' : opts.defaultSeparator;
  this.basePath = opts.basePath || 'locales/';
  this.fallbackLanguages = opts.fallbackLanguages;

  this.localeFileResolver = opts.localeFileResolver || function (lang) {
    return this.basePath + lang + '.json';
  };

  this.locales = opts.locales || [];
  this.langs = opts.langs;
  this.fallbackLocales = opts.fallbackLocales || [];

  const loadFallbacks = cb => {
    this.loadLocales(this.fallbackLanguages, function (...fallbackLocales) {
      this.fallbackLocales.push(...fallbackLocales);

      if (cb) {
        return cb(fallbackLocales);
      }
    }, true);
  };

  if (opts.languages || opts.callback) {
    this.loadLocales(opts.languages, () => {
      const locales = Array.from(arguments);

      const runCallback = fallbackLocales => {
        if (opts.callback) {
          opts.callback.apply(this, [this.getFormatter(opts.namespace), this.getFormatter.bind(this), locales, fallbackLocales]);
        }
      };

      if (opts.hasOwnProperty('fallbackLanguages')) {
        loadFallbacks(runCallback);
      } else {
        runCallback();
      }
    });
  } else if (opts.hasOwnProperty('fallbackLanguages')) {
    loadFallbacks();
  }
}
function IMFClass ( opts ) { if ( ! ( this instanceof IMFClass ) ) { return new IMFClass ( opts ) ; } opts = opts || { } ; this . defaultNamespace = opts . defaultNamespace || '' ; this . defaultSeparator = opts . defaultSeparator === undefined ? '.' : opts . defaultSeparator ; this . basePath = opts . basePath || 'locales/' ; this . fallbackLanguages = opts . fallbackLanguages ; this . localeFileResolver = opts . localeFileResolver || function ( lang ) { return this . basePath + lang + '.json' ; } ; this . locales = opts . locales || [ ] ; this . langs = opts . langs ; this . fallbackLocales = opts . fallbackLocales || [ ] ; const loadFallbacks = cb => { this . loadLocales ( this . fallbackLanguages , function ( ... fallbackLocales ) { this . fallbackLocales . push ( ... fallbackLocales ) ; if ( cb ) { return cb ( fallbackLocales ) ; } } , true ) ; } ; if ( opts . languages || opts . callback ) { this . loadLocales ( opts . languages , ( ) => { const locales = Array . from ( arguments ) ; const runCallback = fallbackLocales => { if ( opts . callback ) { opts . callback . apply ( this , [ this . getFormatter ( opts . namespace ) , this . getFormatter . bind ( this ) , locales , fallbackLocales ] ) ; } } ; if ( opts . hasOwnProperty ( 'fallbackLanguages' ) ) { loadFallbacks ( runCallback ) ; } else { runCallback ( ) ; } } ) ; } else if ( opts . hasOwnProperty ( 'fallbackLanguages' ) ) { loadFallbacks ( ) ; } }
If strawman approved, this would only be
If strawman approved this would only be