lib/babel-core/src/config/option-manager.js
function loadConfig(config) {
  var options = normalizeOptions(config);

  if (config.options.plugins != null && !Array.isArray(config.options.plugins)) {
    throw new Error(".plugins should be an array, null, or undefined");
  }

  var plugins = (config.options.plugins || []).map(function (plugin, index) {
    var _normalizePair = normalizePair(plugin, _files.loadPlugin, config.dirname),
        filepath = _normalizePair.filepath,
        value = _normalizePair.value,
        options = _normalizePair.options;

    return {
      alias: filepath || config.loc + "$" + index,
      loc: filepath || config.loc,
      value: value,
      options: options,
      dirname: config.dirname
    };
  });

  if (config.options.presets != null && !Array.isArray(config.options.presets)) {
    throw new Error(".presets should be an array, null, or undefined");
  }

  var presets = (config.options.presets || []).map(function (preset, index) {
    var _normalizePair2 = normalizePair(preset, _files.loadPreset, config.dirname),
        filepath = _normalizePair2.filepath,
        value = _normalizePair2.value,
        options = _normalizePair2.options;

    return {
      alias: filepath || config.loc + "$" + index,
      loc: filepath || config.loc,
      value: value,
      options: options,
      dirname: config.dirname
    };
  });

  return { options: options, plugins: plugins, presets: presets };
}
function loadConfig(config) {
  var options = normalizeOptions(config);

  if (config.options.plugins != null && !Array.isArray(config.options.plugins)) {
    throw new Error(".plugins should be an array, null, or undefined");
  }

  var plugins = (config.options.plugins || []).map(function (plugin, index) {
    var _normalizePair = normalizePair(plugin, _files.loadPlugin, config.dirname),
        filepath = _normalizePair.filepath,
        value = _normalizePair.value,
        options = _normalizePair.options;

    return {
      alias: filepath || config.loc + "$" + index,
      loc: filepath || config.loc,
      value: value,
      options: options,
      dirname: config.dirname
    };
  });

  if (config.options.presets != null && !Array.isArray(config.options.presets)) {
    throw new Error(".presets should be an array, null, or undefined");
  }

  var presets = (config.options.presets || []).map(function (preset, index) {
    var _normalizePair2 = normalizePair(preset, _files.loadPreset, config.dirname),
        filepath = _normalizePair2.filepath,
        value = _normalizePair2.value,
        options = _normalizePair2.options;

    return {
      alias: filepath || config.loc + "$" + index,
      loc: filepath || config.loc,
      value: value,
      options: options,
      dirname: config.dirname
    };
  });

  return { options: options, plugins: plugins, presets: presets };
}
function loadConfig ( config ) { var options = normalizeOptions ( config ) ; if ( config . options . plugins != null && ! Array . isArray ( config . options . plugins ) ) { throw new Error ( ".plugins should be an array, null, or undefined" ) ; } var plugins = ( config . options . plugins || [ ] ) . map ( function ( plugin , index ) { var _normalizePair = normalizePair ( plugin , _files . loadPlugin , config . dirname ) , filepath = _normalizePair . filepath , value = _normalizePair . value , options = _normalizePair . options ; return { alias : filepath || config . loc + "$" + index , loc : filepath || config . loc , value : value , options : options , dirname : config . dirname } ; } ) ; if ( config . options . presets != null && ! Array . isArray ( config . options . presets ) ) { throw new Error ( ".presets should be an array, null, or undefined" ) ; } var presets = ( config . options . presets || [ ] ) . map ( function ( preset , index ) { var _normalizePair2 = normalizePair ( preset , _files . loadPreset , config . dirname ) , filepath = _normalizePair2 . filepath , value = _normalizePair2 . value , options = _normalizePair2 . options ; return { alias : filepath || config . loc + "$" + index , loc : filepath || config . loc , value : value , options : options , dirname : config . dirname } ; } ) ; return { options : options , plugins : plugins , presets : presets } ; }
Load and validate the given config into a set of options, plugins, and presets.
Load and validate the given config into a set of options plugins and presets .