Reputation: 198258
I found async has two util functions: log
and dir
.
But I don't find many differences between them. See the code:
var async = require('async');
var x = function() {
this.name = 'Freewind';
}
var hello = function(name, callback) {
setTimeout(function() {
callback(null, 'hello ' + name, 'nice to see you ' + name, x, {a:'123'});
}, 200);
};
async.log(hello, 'world');
async.dir(hello, 'world');
It prints:
hello world
nice to see you world
[Function]
{ a: '123' }
'hello world'
'nice to see you world'
[Function]
{ a: '123' }
You can see the only difference is the later one has more '
around the results.
Is there any example to show what dir
can do but log
can't?
Upvotes: 0
Views: 187
Reputation: 207521
Says it in the docs:
Logs the result of an async function to the console. In general it uses console.log
Logs the result of an async function to the console using console.dir to display the properties of the resulting object. In general it uses console.dir. If you use FIrebug, it is like the view in the DOM tab.
Upvotes: 1