refactor: simplify isValidSortMethod (#2393)
This commit is contained in:
1 parent
c9052ff45d
commit
0348ed384d
1 file changed
+5
-9
@@ -22,15 +22,11 @@ const (
|
|||||||
)
|
)
|
||||||
|
|
||||||
func isValidSortMethod(method sortMethod) bool {
|
func isValidSortMethod(method sortMethod) bool {
|
||||||
return method == naturalSort ||
|
switch method {
|
||||||
method == nameSort ||
|
case naturalSort, nameSort, sizeSort, timeSort, atimeSort, btimeSort, ctimeSort, extSort, customSort:
|
||||||
method == sizeSort ||
|
return true
|
||||||
method == timeSort ||
|
}
|
||||||
method == atimeSort ||
|
return false
|
||||||
method == btimeSort ||
|
|
||||||
method == ctimeSort ||
|
|
||||||
method == extSort ||
|
|
||||||
method == customSort
|
|
||||||
}
|
}
|
||||||
|
|
||||||
const invalidSortErrorMessage = `sortby: value should either be 'natural', 'name', 'size', 'time', 'atime', 'btime', 'ctime', 'ext' or 'custom'`
|
const invalidSortErrorMessage = `sortby: value should either be 'natural', 'name', 'size', 'time', 'atime', 'btime', 'ctime', 'ext' or 'custom'`
|
||||||
|
|||||||
Reference in new issue
Block a user