code: function transformVariables(source, dest) {
          var xformed, arrayVals;
  
          if (dest === undefined) {
              xformed = {};
          }
          else {
              xformed = dest;
          }
  
          $.each(source, function(prop, val) {
              if (val instanceof $) {
                  xformed[prop] = val[0];
              }
              else if ($.isPlainObject(val)) {
                  xformed[prop] = {};
                  transformVariables(val, xformed[prop]);
              }
              else if ($.isArray(val)) {
                  arrayVals = [];
                  $.each(val, function(idx, arrayVal) {
                      if (arrayVal instanceof $) {
                          $.merge(arrayVals, arrayVal);
                      }
                      else {
                          arrayVals.push(arrayVal);
                      }
                  });
                  xformed[prop] = arrayVals;
              }
              else {
                  xformed[prop] = val;
              }
          });
  
          if (dest === undefined) {
              return xformed;
          }
      }
docs: transform jQuery objects into HTMLElements, and pass along all other option properties