Comments (3)
I'm actually thinking I could try and do some sort of inference based on the tokens (if/for) at the evaluation step w/ some sort of recursive call back into the engine.
from mutton.
Interesting thoughts! Thanks for opening up the conversation. I haven't given this much thought, but I'm wondering if it's possible to solve this by calling back into mutton as you suggested. Mutton is designed to be low-level and generic. Basically only for simple templates. There could be value in adding more mustache-like features though. The reason why mustache/handlebars did not work for my original use case was because they did not allow for plugging in custom evaluation. Mustache and Handlebars are opinionated in that way (not a bad thing, just didn't work for what I need it for).
I see that jsonata supports $map
and $join
. Perhaps you could do something like:
{{
$join($map(names, function($v, $i, $a) {
$v & ' is a fun name'
}), '\n')
}}
What are your thoughts?
from mutton.
100% - Mutton is great because it is un-opinionated about those type of things.
I wrote a similar expression as a prototype but felt it was just wayyyy too complex for the majority of users. I think striking a balance between super flexible and user friendly is a tough balance. At the same time, I feel like those are pretty typical asks of any engine like this so a boilerplate answer or hook might be the best approach.
from mutton.
Related Issues (7)
- Support for double braces inside of expressions using single or double quotes
- Allow async expression evaluator when rendering from a compiled template
- Support multiple output targets in dist
- Missing NPM Github Repo Link HOT 1
- JSONATA Examples HOT 1
- renderTemplate where expressionEvaluator returns a list HOT 1
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from mutton.