initial commit
This commit is contained in:
29
node_modules/undertaker/lib/helpers/buildTree.js
generated
vendored
Normal file
29
node_modules/undertaker/lib/helpers/buildTree.js
generated
vendored
Normal file
@@ -0,0 +1,29 @@
|
||||
'use strict';
|
||||
|
||||
var map = require('collection-map');
|
||||
|
||||
var metadata = require('./metadata');
|
||||
|
||||
function buildTree(tasks) {
|
||||
return map(tasks, function(task) {
|
||||
var meta = metadata.get(task);
|
||||
if (meta) {
|
||||
return meta.tree;
|
||||
}
|
||||
|
||||
var name = task.displayName || task.name || '<anonymous>';
|
||||
meta = {
|
||||
name: name,
|
||||
tree: {
|
||||
label: name,
|
||||
type: 'function',
|
||||
nodes: [],
|
||||
},
|
||||
};
|
||||
|
||||
metadata.set(task, meta);
|
||||
return meta.tree;
|
||||
});
|
||||
}
|
||||
|
||||
module.exports = buildTree;
|
||||
Reference in New Issue
Block a user