biofriction-wp-theme/node_modules/gulp-cli/lib/versioned/^3.7.0/task-tree.js

28 lines
604 B
JavaScript
Raw Normal View History

2021-10-26 14:18:09 +02:00
'use strict';
module.exports = function(tasks) {
var map = {};
var arr = [];
Object.keys(tasks).forEach(function(taskname) {
var task = {
label: taskname,
type: 'task',
nodes: [],
};
map[taskname] = task;
arr.push(task);
});
Object.keys(tasks).forEach(function(taskname) {
var task = map[taskname];
tasks[taskname].dep.forEach(function(childname) {
var child = map[childname] || {
label: childname,
type: 'task',
nodes: [],
};
task.nodes.push(child);
});
});
return { label: 'Tasks', nodes: arr };
};