Skip to content

Usage question #42

Description

@yanakad

Firstly, thank you so much for maintaining this project. I am trying to adapt the standard line example - I would like to use a template like this:
`
var data = {
items: [1,2,3,100,10,19]
};
var template = {
"{{#each items}}": {
"{{this}}": {
id: "{{this}}"
}
}
}

ST.select(data)
.transformWith(template)
.root()
`

My desired output is
[ { "1": { "id": "1" } },...

but I cannot get {{this}} to evaluate correctly twice.

Is there a way to generate the output that I'm trying to generate -- {{this}} works fine more than once in sibling values, not quite sure why I can't use it as a parent key...or how to bind a single variable to reuse the value

Activity

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions