Skip to content

Instantly share code, notes, and snippets.

@cpdean
cpdean / map_reduce.js
Created January 27, 2014 23:36
q.js demo for merging the results of an arbitrary number of promises generated by an initial promise.
// @cpdean
// demonstrates how to have one promise kick off
// an additional arbitrary number of promises, and
// then merge their results down again after
// all the promises are complete.
var Q = require('q'); // "q": "~1.0.0"
// initial query that generates seed data for more work to be done
function fakeQuery(){