code: function chainPromises(calls, val) {
      if (!calls || !calls.length) { return Q.when(val); }
      return calls.reduce(Q.when, Q.when(val));
  }
docs: Simple function for chaining an array of promise functions. Every function in the
  promise chain needs to be uniform and accept the same input parameter. This
  is used for a number of things, but most importantly for the service call chain
  by API.
  
  @param calls Functions that should all take in a value and return a promise or another object
  @param val The initial value to be passed into the promise chain