This project has moved and is read-only. For the latest updates, please go here.

implement uneval function

Aug 6, 2014 at 6:36 PM
how is it possible to implement an uneval function?
Aug 6, 2014 at 8:46 PM
Perhaps you could start with JSON.stringify() and incorporate Function.prototype.toString()?
Aug 6, 2014 at 9:58 PM
Edited Aug 6, 2014 at 10:16 PM
i would like to implement it in c# as a function for js
Aug 7, 2014 at 5:22 PM
Hi furesoft,

You can use DynamicObject.GetDynamicMemberNames() to enumerate the properties of a script object.

However, you'll have to invoke script functions to retrieve various information such as function source code, whether an object is a function, whether one object is the same as another (for cycle detection), etc. A full uneval() implementation without the script engine's help may not be possible.

Consider also that script invocations are expensive, whereas uneval() can be implemented fully in JavaScript without any hops across the host-script boundary.

Good luck!