mirror of
https://github.com/danog/gojekyll.git
synced 2024-11-26 23:34:47 +01:00
Update filter interface
This commit is contained in:
parent
62580448b2
commit
f1a75669d2
@ -25,8 +25,7 @@ func intVar(name string, ptr **int) kingpin.Action {
|
||||
if err != nil {
|
||||
panic(err)
|
||||
}
|
||||
arg := int(n)
|
||||
*ptr = &arg
|
||||
*ptr = &n
|
||||
}
|
||||
return nil
|
||||
}
|
||||
|
@ -156,11 +156,8 @@ func unimplementedFilter(name string) func(value interface{}) interface{} {
|
||||
}
|
||||
}
|
||||
|
||||
func arrayToSentenceStringFilter(array []string, conjunction interface{}) string {
|
||||
conj, ok := conjunction.(string)
|
||||
if !ok {
|
||||
conj = "and "
|
||||
}
|
||||
func arrayToSentenceStringFilter(array []string, conjunction func(string) string) string {
|
||||
conj := conjunction("and ")
|
||||
switch len(array) {
|
||||
case 1:
|
||||
return array[0]
|
||||
@ -208,11 +205,8 @@ func groupByFilter(array []map[string]interface{}, property string) []map[string
|
||||
return out
|
||||
}
|
||||
|
||||
func sortFilter(array []interface{}, key interface{}, nilFirst interface{}) []interface{} {
|
||||
nf, ok := nilFirst.(bool)
|
||||
if !ok {
|
||||
nf = true
|
||||
}
|
||||
func sortFilter(array []interface{}, key interface{}, nilFirst func(bool) bool) []interface{} {
|
||||
nf := nilFirst(true)
|
||||
out := make([]interface{}, len(array))
|
||||
copy(out, array)
|
||||
if key == nil {
|
||||
|
Loading…
Reference in New Issue
Block a user