Skip to content

Suggestion: Generate Param values given a JSON #42

Description

@rmrbytes

I came across this library while searching for just this functionality. Thanks for sharing it.

I was wondering whether it would be possible to kind of reverse engineer and determine the parameter values given a resultant json.

Let me give an example to clarify what I am seeking:

Suppose the template is defined as

const template = parse("{
    title: 'Fixed Title",
   {foo:baz}
 }");

And passing a foo value generates the json

console.log(template({foo: 'baz'}) // prints {title:'Fixed Title', foo: 'baz'}

But is there a way to get the params given the resultant json. I am using a function called extract as an example to explain what will be useful

console.log(template.extract({title: 'Fixed Title', foo: 'baq'}) // prints {foo: 'baq'} 

Thanks

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Fields

    No fields configured for issues without a type.

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions