0
當我想打電話給seqEach上two_objects的情況下,我該怎麼辦:如何在異步處理函數中解析對象?
Seq()
.seq(function() {
pivotal.getProjects(this);
})
.flatten()
.seqEach(function(data) {
var project_ids = data.project.map(function(x) { return parseInt(x.id); })
console.log('project_ids: '.red + project_ids);
// pivotal.getStories(project.id, { filter: "state:finished" }, this);
})
.seq(function() {
var aggregatedStories = [];
Hash.map(this.args, (function(arg) {
aggregatedStories.push(arg[0]);
}));
res.send(aggregatedStories);
});
日誌:
project_ids: 644511,340755
pivotal.getProjects(this);
回報像
{"project": { "id": 644511}, { "id": 340755} }
所以問題是因爲data
應該換成data.project
但是怎麼做呢?