(function (factory) {
  if (typeof define === 'function' && define.amd) {
    // AMD
    define(['jquery'], factory);
  } else if (typeof exports === 'object') {
    // CommonJS
    factory(require('jquery'));
  } else {
    // Browser globals
    factory(jQuery);
  }
}(function ($) {

  var whenObject = function(object) {
    var deferred = new $.Deferred();
    var promises = [];
    var keys = [];
    $.each(object, function (key, value) {
      keys.push(key);
      promises.push(value);
    });
    $.when.apply(null, promises)
      .done(function (results) {
        var resultsObject = {};
        $.each(results, function (index, value) {
          var key = keys[index];
          resultsObject[key] = value;
        });
        deferred.resolve(resultsObject);
      })
      .fail(function (results) {
        deferred.reject(results);
      });
    return deferred;
  };

  $.whenObject = whenObject;

  return whenObject;
}));

@@ -280,16 +280,221 @@
  ($) %7B%0A%0A
+  var arrayToObject = function (keys, results) %7B%0A    var object = %7B%7D;%0A    $.each(results, function (index, value) %7B%0A      var key = keys%5Bindex%5D;%0A      object%5Bkey%5D = value;%0A    %7D);%0A    return object;%0A  %7D;%0A%0A
   var wh
@@ -801,142 +801,35 @@
 t = 
-%7B%7D;%0A        $.each(results, function (index, value) %7B%0A          var key = keys%5Bindex%5D;%0A          resultsObject%5Bkey%5D = value;%0A        %7D
+arrayToObject(keys, results
 );%0A 
@@ -902,32 +902,90 @@
 ion (results) %7B%0A
+        var resultsObject = arrayToObject(keys, results);%0A
         deferred
@@ -995,24 +995,30 @@
 ject(results
+Object
 );%0A      %7D);

generalize array to object, and use in fail