lib/Plugin.js
function loadPackage(target, location, section, options, done) {
	if(section == 'config') {
		options.dirname = path.resolve(location + '/' + section);
	} else {
		options.dirname = path.resolve(location + '/api/' + section);
	}

	buildDictionary.optional(options, function(err, modules) {
		if(err) return done(err);
		if(section == 'config') {
			for(var i in modules) {
				target.config = _.extend(target.config || {}, modules[i]);	
			}
		} else {
			target[section] = _.extend(target[section] || {}, modules);
		}

		return done();
	});
}
function loadPackage(target, location, section, options, done) {
	if(section == 'config') {
		options.dirname = path.resolve(location + '/' + section);
	} else {
		options.dirname = path.resolve(location + '/api/' + section);
	}

	buildDictionary.optional(options, function(err, modules) {
		if(err) return done(err);
		if(section == 'config') {
			for(var i in modules) {
				target.config = _.extend(target.config || {}, modules[i]);	
			}
		} else {
			target[section] = _.extend(target[section] || {}, modules);
		}

		return done();
	});
}
function loadPackage ( target , location , section , options , done ) { if ( section == 'config' ) { options . dirname = path . resolve ( location + '/' + section ) ; } else { options . dirname = path . resolve ( location + '/api/' + section ) ; } buildDictionary . optional ( options , function ( err , modules ) { if ( err ) return done ( err ) ; if ( section == 'config' ) { for ( var i in modules ) { target . config = _ . extend ( target . config || { } , modules [ i ] ) ; } } else { target [ section ] = _ . extend ( target [ section ] || { } , modules ) ; } return done ( ) ; } ) ; }
This function will merge Sails-like components into an NPM package, forming a Bulkhead package.
@private
@param	Object		The NPM module instance
@param	String		The location of the package
@param	String		The category name of Sails-like components
@param	Object		Sails-build-directory configuration override
@param 	Function	The callback to fire when the package is loaded
This function will merge Sails - like components into an NPM package forming a Bulkhead package .