Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Usage question #42

Open
yanakad opened this issue Aug 17, 2020 · 0 comments
Open

Usage question #42

yanakad opened this issue Aug 17, 2020 · 0 comments

Comments

@yanakad
Copy link

yanakad commented Aug 17, 2020

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

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant