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 { 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'`