Comments (5)
I think this could be useful, especially with multi-arg support. Would you see a version of this wherein the templates the user could simply do each "trim" <args>
(trim just being an example, replace with whatever function) in addition to the each*
you are suggesting
from sprig.
I believe that would either require reflection or a big switch which would in turn call the actual function. It could work, but in my experience explicit function calls work better in this case. Since there is a pattern, it's really easy to guess the behavior.
But yeah, that could work.
from sprig.
@sagikazarmark What would the template functions be, what would they work on, and why those things?
I'm trying to understand the end user need and what would be solved.
The technique looks interesting and I could see uses. Just trying to understand why and how to bake it in here. The why and what it solves is important.
from sprig.
I came looking for something like this. Actually I wanted to runprintf
over elements of a list. I've ended up having to implement my own mapPrintF
function but it would have been much more convenient to have just been able to write e.g. {{ map "printf" "values-%s.yaml" .myList }}
to return a list where each element has been modified by the printf
function. In fact, functional constructs in general (map, reduce, filter, etc.) would be super handy...
from sprig.
@mattfarina sorry, but I don't remember what the use case was.
I guess the idea is that you can output a list of strings, but apply some filters to it first? Unfortunately I rarely use templates these days. :\
from sprig.
Related Issues (20)
- help with merge inside range.
- sortAlpha does not work for list of numbers HOT 2
- sprig still alive? HOT 1
- support pipe for `omit` and `pick`
- Expose digFromDict function HOT 1
- (feat): Implement PBKDF2 as cryptographic function
- Time Comparison Functions HOT 4
- Parse Seconds from Duration HOT 2
- Map function
- How can I avoid getting a scientific notation in a large multiply? HOT 1
- How to convert "a b c" string to json ["a","b","c"]? HOT 1
- required function
- dateInZone silently fails when it doesn't understand the parameters passed to it
- Feature Request: add "yield" function HOT 5
- Proposal: add toDuration HOT 2
- apostrophes are transformed by printf function HOT 1
- Typo in release 2.10.0 Changelog.
- Derive password documentation broken
- Merging a dict over other types fails silently
- is this still supported? HOT 6
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 sprig.