code: function (promises) {
              var count = promises.length;
              if (!count) {
                  return null;
              }
              var defer = new Defer();
              for (var i = 0; i < promises.length; i++) {
                  /*jshint loopfunc:true*/
                  (function (promise, i) {
                      when(promise, function (value) {
                          promises[i] = value;
                          if (--count === 0) {
                              // if all is resolved
                              // then resolve final returned promise with all value
                              defer.resolve(promises);
                          }
                      }, function (r) {
                          // if any one is rejected
                          // then reject final return promise with first reason
                          defer.reject(r);
                      });
                  }(promises[i], i));
              }
              return defer.promise;
          }
docs: return a new promise
  which is resolved when all promises is resolved
  and rejected when any one of promises is rejected
  @param {KISSY.Promise[]} promises list of promises
  @static
  @return {KISSY.Promise}
  @member KISSY.Promise