Skip to content

Commit

Permalink
Lists extension: remove tabs in inline comments.
Browse files Browse the repository at this point in the history
  • Loading branch information
seirl committed Oct 4, 2024
1 parent b1ff30b commit f55c7c6
Showing 1 changed file with 35 additions and 35 deletions.
70 changes: 35 additions & 35 deletions ext/lists.go
Original file line number Diff line number Diff line change
Expand Up @@ -49,59 +49,59 @@ var comparableTypes = []*cel.Type{
// Returns the distinct elements of a list. If the element type is not comparable
// or the element types are not the same, the function will produce an error.
//
// <list(T)>.distinct() -> <list(T)>
// T in {int, uint, double, bool, duration, timestamp, string, bytes}
// <list(T)>.distinct() -> <list(T)>
// T in {int, uint, double, bool, duration, timestamp, string, bytes}
//
// Examples:
//
// [1, 2, 2, 3, 3, 3].distinct() // return [1, 2, 3]
// ["b", "c", "a"].sort() // return ["a", "b", "c"]
// [1, "b"].distinct() // error
// [[1, 2, 3]].distinct() // error
// [1, 2, 2, 3, 3, 3].distinct() // return [1, 2, 3]
// ["b", "c", "a"].sort() // return ["a", "b", "c"]
// [1, "b"].distinct() // error
// [[1, 2, 3]].distinct() // error
//
// # Range
//
// Introduced in version: 2
//
// Returns a list of integers from 0 to n-1.
//
// range(<int>) -> <list(int)>
// range(<int>) -> <list(int)>
//
// Examples:
//
// range(5) -> [0, 1, 2, 3, 4]
// range(5) -> [0, 1, 2, 3, 4]
//
// ## Reverse
//
// Introduced in version: 2
//
// Returns the elements of a list in reverse order.
//
// <list(T)>.reverse() -> <list(T)>
// <list(T)>.reverse() -> <list(T)>
//
// Examples:
//
// [5, 3, 1, 2].reverse() // return [2, 1, 3, 5]
// [5, 3, 1, 2].reverse() // return [2, 1, 3, 5]
//
// # Slice
//
// Returns a new sub-list using the indexes provided.
//
// <list>.slice(<int>, <int>) -> <list>
// <list>.slice(<int>, <int>) -> <list>
//
// Examples:
//
// [1,2,3,4].slice(1, 3) // return [2, 3]
// [1,2,3,4].slice(2, 4) // return [3 ,4]
// [1,2,3,4].slice(1, 3) // return [2, 3]
// [1,2,3,4].slice(2, 4) // return [3 ,4]
//
// # Flatten
//
// Flattens a list recursively.
// If an optional depth is provided, the list is flattened to a the specificied level.
// A negative depth value will result in an error.
//
// <list>.flatten(<list>) -> <list>
// <list>.flatten(<list>, <int>) -> <list>
// <list>.flatten(<list>) -> <list>
// <list>.flatten(<list>, <int>) -> <list>
//
// Examples:
//
Expand All @@ -118,15 +118,15 @@ var comparableTypes = []*cel.Type{
// Sorts a list with comparable elements. If the element type is not comparable
// or the element types are not the same, the function will produce an error.
//
// <list(T)>.sort() -> <list(T)>
// T in {int, uint, double, bool, duration, timestamp, string, bytes}
// <list(T)>.sort() -> <list(T)>
// T in {int, uint, double, bool, duration, timestamp, string, bytes}
//
// Examples:
//
// [3, 2, 1].sort() // return [1, 2, 3]
// ["b", "c", "a"].sort() // return ["a", "b", "c"]
// [1, "b"].sort() // error
// [[1, 2, 3]].sort() // error
// [3, 2, 1].sort() // return [1, 2, 3]
// ["b", "c", "a"].sort() // return ["a", "b", "c"]
// [1, "b"].sort() // error
// [[1, 2, 3]].sort() // error
//
// # SortBy
//
Expand All @@ -135,12 +135,12 @@ var comparableTypes = []*cel.Type{
//
// Examples:
//
// [
// Player { name: "foo", score: 0 },
// Player { name: "bar", score: -10 },
// Player { name: "baz", score: 1000 },
// ].sortBy(e, e.score).map(e, e.name)
// == ["bar", "foo", "baz"]
// [
// Player { name: "foo", score: 0 },
// Player { name: "bar", score: -10 },
// Player { name: "baz", score: 1000 },
// ].sortBy(e, e.score).map(e, e.name)
// == ["bar", "foo", "baz"]
//
// # SortByAssociatedKeys
//
Expand All @@ -150,12 +150,12 @@ var comparableTypes = []*cel.Type{
// another list of comparable elements. If the element type of the keys is not
// comparable or the element types are not the same, the function will produce an error.
//
// <list(T)>.sortByAssociatedKeys(<list(U)>) -> <list(T)>
// U in {int, uint, double, bool, duration, timestamp, string, bytes}
// <list(T)>.sortByAssociatedKeys(<list(U)>) -> <list(T)>
// U in {int, uint, double, bool, duration, timestamp, string, bytes}
//
// Examples:
//
// ["foo", "bar", "baz"].sortByAssociatedKeys([3, 1, 2]) // return ["bar", "baz", "foo"]
// ["foo", "bar", "baz"].sortByAssociatedKeys([3, 1, 2]) // return ["bar", "baz", "foo"]

func Lists(options ...ListsOption) cel.EnvOption {
l := &listsLib{
Expand Down Expand Up @@ -499,11 +499,11 @@ func sortListByAssociatedKeys(list traits.Lister, keys traits.Lister) (ref.Val,
//
// into:
//
// cel.bind(
// __sortBy_input__,
// myListExpr,
// __sortBy_input__.sortByAssociatedKeys(__sortBy_input__.map(e, -math.abs(e))
// )
// cel.bind(
// __sortBy_input__,
// myListExpr,
// __sortBy_input__.sortByAssociatedKeys(__sortBy_input__.map(e, -math.abs(e))
// )
func sortByMacro(meh cel.MacroExprFactory, target ast.Expr, args []ast.Expr) (ast.Expr, *cel.Error) {
varIdent := meh.NewIdent("__sortBy_input__")
varName := varIdent.AsIdent()
Expand Down

0 comments on commit f55c7c6

Please sign in to comment.