code: function(obj, target) {
              if (obj == null) {
                  return null;
              }
              var r = JSON.parse(JSON.stringify(obj));
              if (!target) {
                  return r;
              }
  
              for (var i in r) {
                  target[i] = r[i];
              }
              return target;
          }
docs: separated just to improve if it doesn't work