From 3280ab57bffb3fa1018d406eb25a3d98564a51d7 Mon Sep 17 00:00:00 2001 From: Matthias Schiffer Date: Tue, 5 Jan 2016 18:10:35 +0100 Subject: Implement basic map rendering --- src/util.coffee | 12 ++++++++++++ 1 file changed, 12 insertions(+) create mode 100644 src/util.coffee (limited to 'src/util.coffee') diff --git a/src/util.coffee b/src/util.coffee new file mode 100644 index 0000000..d2cea04 --- /dev/null +++ b/src/util.coffee @@ -0,0 +1,12 @@ +'use strict' + +_ = require 'lodash' + +module.exports = + mapPromises: (promises) -> + _.reduce promises, ((seq, v, k) -> + seq.then (acc) -> + v.then (r) -> + acc[k] = r + acc + ), Promise.resolve {} -- cgit v1.2.3