mirror of
https://github.com/MontFerret/ferret.git
synced 2025-07-03 00:46:51 +02:00
build core.Functions with map
This commit is contained in:
@ -6,30 +6,31 @@ import (
|
||||
)
|
||||
|
||||
func RegisterLib(ns core.Namespace) error {
|
||||
return ns.RegisterFunctions(core.FunctionsMap{
|
||||
"APPEND": Append,
|
||||
"FIRST": First,
|
||||
"FLATTEN": Flatten,
|
||||
"INTERSECTION": Intersection,
|
||||
"LAST": Last,
|
||||
"MINUS": Minus,
|
||||
"NTH": Nth,
|
||||
"OUTERSECTION": Outersection,
|
||||
"POP": Pop,
|
||||
"POSITION": Position,
|
||||
"PUSH": Push,
|
||||
"REMOVE_NTH": RemoveNth,
|
||||
"REMOVE_VALUE": RemoveValue,
|
||||
"REMOVE_VALUES": RemoveValues,
|
||||
"SHIFT": Shift,
|
||||
"SLICE": Slice,
|
||||
"SORTED": Sorted,
|
||||
"SORTED_UNIQUE": SortedUnique,
|
||||
"UNION": Union,
|
||||
"UNION_DISTINCT": UnionDistinct,
|
||||
"UNIQUE": Unique,
|
||||
"UNSHIFT": Unshift,
|
||||
})
|
||||
return ns.RegisterFunctions(
|
||||
core.NewFunctionsFromMap(map[string]core.Function{
|
||||
"APPEND": Append,
|
||||
"FIRST": First,
|
||||
"FLATTEN": Flatten,
|
||||
"INTERSECTION": Intersection,
|
||||
"LAST": Last,
|
||||
"MINUS": Minus,
|
||||
"NTH": Nth,
|
||||
"OUTERSECTION": Outersection,
|
||||
"POP": Pop,
|
||||
"POSITION": Position,
|
||||
"PUSH": Push,
|
||||
"REMOVE_NTH": RemoveNth,
|
||||
"REMOVE_VALUE": RemoveValue,
|
||||
"REMOVE_VALUES": RemoveValues,
|
||||
"SHIFT": Shift,
|
||||
"SLICE": Slice,
|
||||
"SORTED": Sorted,
|
||||
"SORTED_UNIQUE": SortedUnique,
|
||||
"UNION": Union,
|
||||
"UNION_DISTINCT": UnionDistinct,
|
||||
"UNIQUE": Unique,
|
||||
"UNSHIFT": Unshift,
|
||||
}))
|
||||
}
|
||||
|
||||
func ToUniqueArray(arr *values.Array) *values.Array {
|
||||
|
Reference in New Issue
Block a user