Possible Duplicate:
Cloning an Object in Node.js
I want to clone a Cheerio function object, but am having problems using the regular methods.
So, say the object is $object
, I have tried to clone it doing:
eval("var clone = " + $object.toString());
But then I get this error message:
var clone = [object Function]
Here's the output of the original $object
{ [Function: initialize]
_root:
{ type: 'root',
name: 'root',
parent: null,
prev: null,
next: null,
children: [] } }
So, does anyone know how I can clone this thing (in a fast way?)