We have a module that allows users to create some scripts.
I would like to determine if user has used correct properties etc.
For example user has wrote:
var test = session;
I can do:
var something = eval("session");
if (!something){
// Throw error here
}
But i'm facing issues with this:
var test = session.id; // session id property is "id123456"
I thought i can do:
var something = eval("session.id");
if (!something){
// Throw error here
}
But it seems it really does this:
var something = eval("id123456");
Any suggestions how can i determine wheter property exist in this object, also property in property and further?
As i said, i'm not trying to determine some certain object for some certain property, the strcture can be:
session.id.toString().name ... and further
In addition, i have just tried this:
session.hasOwnProperty("id"); // returned false
session.id // returned "id123456"