0

What should I do in case when I want to call seqEach on 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);
 });

Logs:

project_ids: 644511,340755

pivotal.getProjects(this);

returns something like

{"project": { "id": 644511}, { "id": 340755} }

So problem is because data should be replaced by data.project but how to do it?

asked Mar 30, 2013 at 14:08

1 Answer 1

1

So problem is because data should be replaced by data.project but how to do it?

Either you add the line data = data.project; on top of your seqEach callback, or you inject a mapping function like

.map(function(d) { return d.project; })

into your chain. Or you just change the pivotal.getProjects method...

answered Mar 30, 2013 at 16:05
Sign up to request clarification or add additional context in comments.

Comments

Your Answer

Draft saved
Draft discarded

Sign up or log in

Sign up using Google
Sign up using Email and Password

Post as a guest

Required, but never shown

Post as a guest

Required, but never shown

By clicking "Post Your Answer", you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.