I am kind of confused with the logic of results which go from one task to the other task in async.auto. For example in the following code logic I added some data to models in task1
, which is initially an output from initialtask
and in finalTask
added data to models from task1
is reflected in results.initialTask1
as well. Similarly added data in task2
is reflected in results.initialTask1
in finalTask
.
To sum up all of results.initialTask1
, results.task1[0]
, results.task2[0]
, results.task3[0]
are identical in finalTask
. Is this the logic of async.auto
? Or is it something like reference by pointer in C++ which causes whatever changes for models in task1
, it reflects in models in initialTask
as well?
async.auto({
initialTask: function(callback) {
//Do some operations
callback(null, name, initialModels);
},
task1: ['initialTask', function(callback, results) {
var models = results.initialTask[1];
//Add some more data to models
callback(null, models);
}],
task2: ['initialTask', function(callback, results) {
var models = results.initialTask[1];
//Add some more data to models
callback(null, models);
}],
task3: ['initialTask', function(callback, results) {
var models = results.initialTask[1];
//Add some more data to models
callback(null, models);
}],
finalTask: ['task1', 'task2', 'task3', function(callback, results) {
//Here the followings are the same: results.initialTask[1], results.task1[0], results.task2[0], results.task3[0]
}]
});
I'm looking for any answer which helps me make sure that is the logic or not? I'm not necessarily looking for any official documents or ...