I think this is the essence of a deep copy:
function deepCopy(a) {
switch (a.type) {
case "hash":
var b = {};
for (var i = a.keys.length; i > 0; --i) {
var key = a.keys[i];
b[key] = deepCopy(a[key]);
}
return b;
case "array":
var b = [];
for (var j = a.length; j > 0; --j) {
b[j] = deepCopy(a[j]);
}
return b;
default:
return a;
}
}
------------------------------------------------------------------------------
_______________________________________________
Jmol-users mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/jmol-users