lib/index.js
function _validateConfig(configObject, mittoObject) {
  var packageObject = _findFile('package.json');
  if (!mittoObject) {
    return configObject;
  }

  if (!configObject && mittoObject.required && Object.keys(mittoObject.required).length) {
    throw new Error(mittoObject.name + " configuration file not found, and is required by " + packageObject.name);
  } else if (!configObject && mittoObject.hasDefault) {
    return _addOnDefaults({}, mittoObject);
  } else if (!configObject) {
    return configObject;
  }

  for (var key in mittoObject.required) {
    if (!configObject.hasOwnProperty(key)) {
      throw new Error("Required property " + key + " not found in " + mittoObject.name);
    } else if (_typeof(configObject[key]) !== mittoObject.required[key].type) {
      throw new Error("Required property " + key + " expected to be of type " + mittoObject.required[key].type);
    }
  }

  for (var key in mittoObject.optional) {
    if (configObject[key] && _typeof(configObject[key]) !== mittoObject.optional[key].type) {
      throw new Error("Optional property " + key + " is type " + _typeof(configObject[key]) + " and expected to be of type " + mittoObject.optional[key].type);
    }
  }

  if (mittoObject.hasDefault) {
    return _addOnDefaults(configObject, mittoObject);
  }

  return configObject;
}
function _validateConfig(configObject, mittoObject) {
  var packageObject = _findFile('package.json');
  if (!mittoObject) {
    return configObject;
  }

  if (!configObject && mittoObject.required && Object.keys(mittoObject.required).length) {
    throw new Error(mittoObject.name + " configuration file not found, and is required by " + packageObject.name);
  } else if (!configObject && mittoObject.hasDefault) {
    return _addOnDefaults({}, mittoObject);
  } else if (!configObject) {
    return configObject;
  }

  for (var key in mittoObject.required) {
    if (!configObject.hasOwnProperty(key)) {
      throw new Error("Required property " + key + " not found in " + mittoObject.name);
    } else if (_typeof(configObject[key]) !== mittoObject.required[key].type) {
      throw new Error("Required property " + key + " expected to be of type " + mittoObject.required[key].type);
    }
  }

  for (var key in mittoObject.optional) {
    if (configObject[key] && _typeof(configObject[key]) !== mittoObject.optional[key].type) {
      throw new Error("Optional property " + key + " is type " + _typeof(configObject[key]) + " and expected to be of type " + mittoObject.optional[key].type);
    }
  }

  if (mittoObject.hasDefault) {
    return _addOnDefaults(configObject, mittoObject);
  }

  return configObject;
}
function _validateConfig ( configObject , mittoObject ) { var packageObject = _findFile ( 'package.json' ) ; if ( ! mittoObject ) { return configObject ; } if ( ! configObject && mittoObject . required && Object . keys ( mittoObject . required ) . length ) { throw new Error ( mittoObject . name + " configuration file not found, and is required by " + packageObject . name ) ; } else if ( ! configObject && mittoObject . hasDefault ) { return _addOnDefaults ( { } , mittoObject ) ; } else if ( ! configObject ) { return configObject ; } for ( var key in mittoObject . required ) { if ( ! configObject . hasOwnProperty ( key ) ) { throw new Error ( "Required property " + key + " not found in " + mittoObject . name ) ; } else if ( _typeof ( configObject [ key ] ) !== mittoObject . required [ key ] . type ) { throw new Error ( "Required property " + key + " expected to be of type " + mittoObject . required [ key ] . type ) ; } } for ( var key in mittoObject . optional ) { if ( configObject [ key ] && _typeof ( configObject [ key ] ) !== mittoObject . optional [ key ] . type ) { throw new Error ( "Optional property " + key + " is type " + _typeof ( configObject [ key ] ) + " and expected to be of type " + mittoObject . optional [ key ] . type ) ; } } if ( mittoObject . hasDefault ) { return _addOnDefaults ( configObject , mittoObject ) ; } return configObject ; }
Validate the consuming user's present config to ensure it meets the product producer's .mitto syntatical specifications
Validate the consuming user s present config to ensure it meets the product producer s . mitto syntatical specifications