Comments (6)
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.
I'm indeed surprised that Stencil itself have join
but doesn't have split
from stencilswiftkit.
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.
@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.
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.
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)
- Change our filters to accept a `mode` parameter instead of a boolean.
- SwiftIdentifier filter: add modes for more flexibility
- Replace filter: unescape backslashes HOT 7
- Map only works with strings HOT 14
- Make `Filter`s public HOT 2
- Test Swift 4.2 (or drop support for it) HOT 4
- swiftIdentifier converts all caps to title case HOT 3
- new release
- HEX Data for Colors.xcassets HOT 1
- question: is map supported for dictionaries? HOT 1
- Adding spm dependency on StencilSwiftKit causes warning in project, soon to be error HOT 2
- question: how to combine keys of multiple dictionaries in a single list and remove duplicates
- How can I keep {{ }} in stencil?
- Mutations inside forloop not visible outside HOT 3
- Calling macro with a parameter invoking a filter crashes HOT 4
- `set` tag not respecting scope in `for` loop HOT 8
- Is it possible to use it with Sourcery? HOT 1
- reusable macro templates HOT 4
- Build failure using Swift 4.2 from Xcode 10 Beta HOT 4
- Release 2.6.0 HOT 2
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 stencilswiftkit.