|
|
@ -406,18 +406,32 @@ Client.prototype.mirrorObject = function(handle, cb) { |
|
|
|
return; |
|
|
|
} |
|
|
|
|
|
|
|
var mirror = {}; |
|
|
|
var mirror; |
|
|
|
if (handle.className == 'Array') { |
|
|
|
mirror = []; |
|
|
|
} else { |
|
|
|
mirror = {}; |
|
|
|
} |
|
|
|
|
|
|
|
for (var i = 0; i < handle.properties.length; i++) { |
|
|
|
var value = res.body[handle.properties[i].ref]; |
|
|
|
mirror[handle.properties[i].name] = value.text; |
|
|
|
var mirrorValue = value.value ? value.value : value.text; |
|
|
|
|
|
|
|
if (Array.isArray(mirror) && |
|
|
|
typeof handle.properties[i].name != 'number') { |
|
|
|
// Skip the 'length' property.
|
|
|
|
continue; |
|
|
|
} |
|
|
|
|
|
|
|
mirror[handle.properties[i].name] = mirrorValue; |
|
|
|
} |
|
|
|
|
|
|
|
if (cb) cb(mirror); |
|
|
|
}); |
|
|
|
|
|
|
|
} else if (handle.type == 'string') { |
|
|
|
} else if (handle.value) { |
|
|
|
process.nextTick(function() { |
|
|
|
cb(handle.text); |
|
|
|
cb(handle.value); |
|
|
|
}); |
|
|
|
|
|
|
|
} else { |
|
|
|