MCPcopy Create free account
hub / github.com/SAP/ui5-project / traverseDepthFirst

Method traverseDepthFirst

lib/graph/ProjectGraph.js:445–456  ·  view source on GitHub ↗

* Visit every project in the graph that can be reached by the given entry project exactly once. * The entry project defaults to the root project. * In case a cycle is detected, an error is thrown * * @public * @param {string} [startName] Name of the project to start the traversal at. Defau

(startName, callback)

Source from the content-addressed store, hash-verified

443 * @param {@ui5/project/graph/ProjectGraph~traversalCallback} callback Will be called
444 */
445 async traverseDepthFirst(startName, callback) {
446 if (!callback) {
447 // Default optional first parameter
448 callback = startName;
449 startName = this._rootProjectName;
450 }
451
452 if (!this.getProject(startName)) {
453 throw new Error(`Failed to start graph traversal: Could not find project ${startName} in project graph`);
454 }
455 return this._traverseDepthFirst(startName, Object.create(null), [], callback);
456 }
457
458 async _traverseDepthFirst(projectName, visited, ancestors, callback) {
459 this._checkCycle(ancestors, projectName);

Callers 8

_traverseFunction · 0.80
_traverseFunction · 0.80
ProjectGraph.jsFile · 0.80
graphFromObject.jsFile · 0.80
_testBasicGraphCreationFunction · 0.80
_testGraphCreationFunction · 0.80
ui5Framework.jsFile · 0.80
defineTestFunction · 0.80

Calls 3

getProjectMethod · 0.95
_traverseDepthFirstMethod · 0.95
createMethod · 0.80

Tested by

no test coverage detected