hacksparrow / safe-eval

Safer version of eval()
257 stars 37 forks source link

Object as value in the Context object returns [object Object] #9

Closed NickLeeUML closed 6 years ago

NickLeeUML commented 6 years ago

Hi,

In the following code the result is undefined. When I set expression = name result is [object Object]. I'm not sure what I am doing wrong. Any clues?

  const context = {
             name: {'city':'Boston'},
              id: 20
          }
   const expression="name.city"
   const result = safeEval(expression,context)
NickLeeUML commented 6 years ago

Looks like name is a reserved word.