Giter Club home page Giter Club logo

Comments (3)

amcdnl avatar amcdnl commented on September 24, 2024

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.

austinkelleher avatar austinkelleher commented on September 24, 2024

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.

amcdnl avatar amcdnl commented on September 24, 2024

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)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo 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.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.