Coder Social home page Coder Social logo

Comments (6)

evan-gordon avatar evan-gordon commented on June 14, 2024 1

Sure, no worries.

For reference if you want to see what the changes would look like check here:
evan-gordon@b43a502

Fyi, this is the .0. index implementation.

Forgive my erlang if it's not very good, I use Elixir typically.

from bbmustache.

evan-gordon avatar evan-gordon commented on June 14, 2024 1

Yeah i was aware of the support for assoc lists, and i thought of adding a flag for possibly enabling this feature as it's something i have to support.

Thanks for the patch i appreciate it! Though I'm sad to hear this won't be officcially supported.
I'll close the ticket then.

from bbmustache.

soranoba avatar soranoba commented on June 14, 2024

Hi, @evan-gordon
Can you tell me some libraries that support this syntax?

from bbmustache.

evan-gordon avatar evan-gordon commented on June 14, 2024

Sure!

It seems like mustache JS does:
janl/mustache.js#158

samskivert/jmustache#44

This seems to be a popular stackoverflow issue on the topic:
https://stackoverflow.com/questions/11147373/only-show-the-first-item-in-list-using-mustache/17950970#17950970
they suggest that handlebars.js supports the .[0]. synatax.

It looks like mustache.java supports it, but as an extension (not too sure what that means)
spullara/mustache.java#68

Most libraries (and the mustache spec) don't seem to document it though so it's hard to find more information than this.

from bbmustache.

soranoba avatar soranoba commented on June 14, 2024

Thank you for the information.
I will check and decide, so please wait for a few days. 🙇

from bbmustache.

soranoba avatar soranoba commented on June 14, 2024

mustache/mustache#222 (comment)

As far as I looked into it, as Ricardo said in this comment, I think that this behavior depends on the implementation of javascript.

  • I am negative about adding syntax, because it possible syntax collision in the future.
  • Some libraries have similar issues, but many of them are not solved.
  • It currently supports assoc list, so it is difficult to prioritize array and assoc list.
    • If data is [{"a", [{"0", "value"}]}], it is difficult to determine whether a.0 refers to "value" or {"0", "value"}.

For these reasons, I will avoid official support.


FYI:
I put a patch I wrote, because I am worry about the performance waste of your implementation.
https://gist.github.com/soranoba/2d0c53b3c293beb011f5a2fcbe961648

from bbmustache.

Related Issues (20)

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.