lib/dependencyTools.js
function buildDependencyGraph(module, dependencies, graph) {
	if (module && !graph[module]) {
		graph[module] = [];
	}

	var dependencyNames = Object.keys(dependencies);
	dependencyNames.forEach(function(dependencyName) {
		var dependency = dependencies[dependencyName];

		if (module && graph[module].indexOf(dependencyName) === -1) {
			graph[module].push(dependencyName);
		}

		// Traverse down to this dependency dependencies:
		// Dependency-ception.
		if (dependency.dependencies) {
			buildDependencyGraph(dependencyName, dependency.dependencies, graph);
		}
	});
}
function buildDependencyGraph(module, dependencies, graph) {
	if (module && !graph[module]) {
		graph[module] = [];
	}

	var dependencyNames = Object.keys(dependencies);
	dependencyNames.forEach(function(dependencyName) {
		var dependency = dependencies[dependencyName];

		if (module && graph[module].indexOf(dependencyName) === -1) {
			graph[module].push(dependencyName);
		}

		// Traverse down to this dependency dependencies:
		// Dependency-ception.
		if (dependency.dependencies) {
			buildDependencyGraph(dependencyName, dependency.dependencies, graph);
		}
	});
}
function buildDependencyGraph ( module , dependencies , graph ) { if ( module && ! graph [ module ] ) { graph [ module ] = [ ] ; } var dependencyNames = Object . keys ( dependencies ) ; dependencyNames . forEach ( function ( dependencyName ) { var dependency = dependencies [ dependencyName ] ; if ( module && graph [ module ] . indexOf ( dependencyName ) === - 1 ) { graph [ module ] . push ( dependencyName ) ; } // Traverse down to this dependency dependencies: // Dependency-ception. if ( dependency . dependencies ) { buildDependencyGraph ( dependencyName , dependency . dependencies , graph ) ; } } ) ; }
Builds up a dependency graph for using a simple object structure containing the modules as keys and using arrays
as dependecy descriptors.
Builds up a dependency graph for using a simple object structure containing the modules as keys and using arrays as dependecy descriptors .