Skip to content

Substitute() nested variables #248

Open
@acarbonellb

Description

@acarbonellb

Hello!

Just wondering if there is a way to use substitute to resolve object property references. For example:

// having:
const exp = parser.parse('variable1 + myObject.variable2 + variable3')

// what I want to do is:
const resolved = exp.substitute('myObject.variable2', 1234)
resolved.toString() // 'variable1 + 1234 + variable3'

However, seems like the substitute mechanism is not able to interpolate it.
Hope you can help me on this. Thanks!

Metadata

Metadata

Assignees

No one assigned

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions