title: chain array of promises with bluebird
body: <p>I'm a working my way with promises and I'm stuck with my use case. 
  I have an array of transformer functions (each function is a promise and modifies some JSON structure).</p>
  
  <p>Let me show some code.</p>
  
  <p>Lets say this is my JSON structure (array)</p>
  
  <pre><code>var data = [{a: 1, b:2}, {a:3, b:4}]; 
  </code></pre>
  
  <p><code>transformFunction</code> is definition of transform functions modifying the data a certain way. The two functions adds <code>c</code> and <code>d</code> property to the above JSON structure:</p>
  
  <pre><code>var transformFunctions = { // 
  
      transform1: function (data) {  // This function adds `c` property to each object from `a`
          return new Promise(function (resolve) {
               for (var i = 0; i &lt; data.length; i++) {
                   data[i].c = data[i].a;
               }
               return resolve(data);
          })
      },
  
      transform2: function (data) {  // This function adds `d` property to each object from `c`
          return new Promise(function (resolve) {
               for (var i = 0; i &lt; data.length; i++) {
                   data[i].d = data[i].c;
               }
               return resolve(data);
          })
      },
      ...
  }
  </code></pre>
  
  <p>The from a UI user specifies which transformer functions he should use and in what order. Lets say he picked the normal order like this:</p>
  
  <pre><code>var userTransformList = ['transform1', 'transform2'];
  </code></pre>
  
  <p>The <code>transform1</code> method should modify the data and the result should be passed to <code>transform2</code> method.</p>
  
  <p>I was looking at: <code>Promise.all</code> but it seems that it does not care for the order of the promises, and most important it needs to pass the previous result to the next promise.</p>