index.js
function normalizeConfig(config, defaults) {
	if (_.isUndefined(config)) {
		config = {};
	}

	if (!_.isObject(config)) {
		throw new TypeError('`config` must be an object');
	}

	if (_.isUndefined(defaults)) {
		defaults = {};
	}

	if (!_.isObject(defaults)) {
		throw new TypeError('`defaults` must be an object');
	}

	config = _.defaults({}, config, defaults, {
		pantries: {},
		pantrySearchPaths: [path.resolve('node_modules')]
	});

	if (!_.isObject(config.pantries)) {
		throw new TypeError('`config.pantries` must be an object');
	}

	if (!_.isArray(config.pantrySearchPaths)) {
		throw new TypeError('`config.pantrySearchPaths` must be an Array');
	}

	return config;
}
function normalizeConfig(config, defaults) {
	if (_.isUndefined(config)) {
		config = {};
	}

	if (!_.isObject(config)) {
		throw new TypeError('`config` must be an object');
	}

	if (_.isUndefined(defaults)) {
		defaults = {};
	}

	if (!_.isObject(defaults)) {
		throw new TypeError('`defaults` must be an object');
	}

	config = _.defaults({}, config, defaults, {
		pantries: {},
		pantrySearchPaths: [path.resolve('node_modules')]
	});

	if (!_.isObject(config.pantries)) {
		throw new TypeError('`config.pantries` must be an object');
	}

	if (!_.isArray(config.pantrySearchPaths)) {
		throw new TypeError('`config.pantrySearchPaths` must be an Array');
	}

	return config;
}
function normalizeConfig ( config , defaults ) { if ( _ . isUndefined ( config ) ) { config = { } ; } if ( ! _ . isObject ( config ) ) { throw new TypeError ( '`config` must be an object' ) ; } if ( _ . isUndefined ( defaults ) ) { defaults = { } ; } if ( ! _ . isObject ( defaults ) ) { throw new TypeError ( '`defaults` must be an object' ) ; } config = _ . defaults ( { } , config , defaults , { pantries : { } , pantrySearchPaths : [ path . resolve ( 'node_modules' ) ] } ) ; if ( ! _ . isObject ( config . pantries ) ) { throw new TypeError ( '`config.pantries` must be an object' ) ; } if ( ! _ . isArray ( config . pantrySearchPaths ) ) { throw new TypeError ( '`config.pantrySearchPaths` must be an Array' ) ; } return config ; }
Normalize an config common to a Roux pantry

Some modules, such as roux-sass-importer may want to expose a similar api to
resolve. This method validates and initializes the configuration accepted by
the resolve method.

@param {Object} [config] - configuration object
@param {Object} config.pantries - a cache of `Pantry` instances
@param {string[]} config.pantrySearchPaths - the paths to search for pantries
@param {Object} defaults defaults to use when initializing the config

@return {Object} valid and initialized config
Normalize an config common to a Roux pantry