Git Product home page Git Product logo

Comments (6)

djbe avatar djbe commented on June 12, 2024 1

Hmmm, that might be an interesting use case, if you want, you can open an issue to discuss the definition of such a filter. And it might be a good starter task, if you'd like to implement it 😉

from stencilswiftkit.

AliSoftware avatar AliSoftware commented on June 12, 2024 1

I'm indeed surprised that Stencil itself have join but doesn't have split 🤔 Interesting filter to add indeed

from stencilswiftkit.

djbe avatar djbe commented on June 12, 2024

You could just check if myValue.count is true, or greater than 0. Should that expression evaluate to nil, it will be considered as false --> a single value. Otherwise you have an array.

from stencilswiftkit.

samskiter avatar samskiter commented on June 12, 2024

@djbe Its proving kind of nasty to use that way. I'm actually doing it by using the empty clause of for loops

from stencilswiftkit.

djbe avatar djbe commented on June 12, 2024

TBH, I think in this case that the generated context just has a bizarre structure. It shouldn't return either a Annotation in some cases, and Array<Annotation> in others. The context generator should always return a Array<Annotation>, even if there's just one object.

I don't see this as being a common enough use case to add a specific filter/tag for.

from stencilswiftkit.

samskiter avatar samskiter commented on June 12, 2024

sounds reasonable, thanks for the reply @djbe

Another related tag that might be useful would be the 'split' function - splitting a string up into an array would mean I could use just one Annotation and split the content up into its parts the template

from stencilswiftkit.

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.