tree-visitor-async

Visit nodes in the tree asynchronously and sequentially. Supports promises.

Tree Visitor Async

Visit nodes in the tree asynchronously and sequentially.

Like Tree Visitor, but actions accept an additional callback function that should be called when it's done processing the node.

var VisitorAsync = require('tree-visitor-async');
 
var nodes = [
    { type: 'import', value: 'path/to/file1' },
    { type: 'import', value: 'path/to/file2' },
];
var visitorAsync = new VisitorAsync({
    importfunction (visitorimportNodedone) {
        fs.readFile(importNode.value, 'utf8', done);
    }
});
visitorAsync.visit(nodes, function (err) {
    if (err) throw err;
});

visit() also accepts a callback function that will be called when all node in the tree has been processed.