0

I have a database query, that returns an array, I convert it to EventStream like so:

var stream = Bacon.fromNodeCallback(queryManager, "findAll").flatMap(Bacon.fromArray);

And then with each value of the stream, I need to update its properties:

var otherStream = stream.map(function(val) {
  val.property1 = "blah blah";
  return val;
});

So now I want to get all values of "otherStream" as array, then I can manipulate them at once. Is it possible to do this with Bacon?

dee
  • 23
  • 3

1 Answers1

0

You could just map the results array without converting it to separate stream values.

Bacon.fromNodeCallback(queryManager, "findAll").map(function(results) {
  return results.map(function(val) {
    val.property1 = "blah blah";
    return val;
  });
}));
JJuutila
  • 361
  • 1
  • 4