You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
These are .first() and .last() which return the first and (unsurprisingly) last elements of a list.
This is useful when you want to split a string and take the first (or last) element in that list in a single expression, without having to resplit and calculate the length.
Would these be useful to add to the list extension?
reacted with thumbs up emoji reacted with thumbs down emoji reacted with laugh emoji reacted with hooray emoji reacted with confused emoji reacted with heart emoji reacted with rocket emoji reacted with eyes emoji
-
I've implemented a couple of functions in projects that use CEL the easiest to link to is in Tekton Triggers:
https://github.com/tektoncd/triggers/blob/b133ef7b0d689c78a342879411a78c74b89de1f5/pkg/interceptors/cel/triggers.go#L202-L207
These are
.first()
and.last()
which return the first and (unsurprisingly) last elements of a list.This is useful when you want to split a string and take the first (or last) element in that list in a single expression, without having to resplit and calculate the length.
Would these be useful to add to the list extension?
I'm happy to do the work for this.
Beta Was this translation helpful? Give feedback.
All reactions