refactor: simplify isValidSortMethod (#2393)

This commit is contained in:
CatsDeservePets authored and GitHub committed 2026-02-13 22:37:06 +01:00
1 parent c9052ff45d
commit 0348ed384d
1 file changed
+5 -9
+5 -9
View File
@@ -22,15 +22,11 @@ const (
)
func isValidSortMethod(method sortMethod) bool {
return method == naturalSort ||
method == nameSort ||
method == sizeSort ||
method == timeSort ||
method == atimeSort ||
method == btimeSort ||
method == ctimeSort ||
method == extSort ||
method == customSort
switch method {
case naturalSort, nameSort, sizeSort, timeSort, atimeSort, btimeSort, ctimeSort, extSort, customSort:
return true
}
return false
}
const invalidSortErrorMessage = `sortby: value should either be 'natural', 'name', 'size', 'time', 'atime', 'btime', 'ctime', 'ext' or 'custom'`