ref: df1f2fb3daa1acd25c88510f259d5535fb482126
dir: /object/tree/path_prefix.go/
package tree
import (
"bytes"
"slices"
)
// HasPathPrefix reports whether path begins with prefix as whole components.
func HasPathPrefix(path, prefix [][]byte) bool {
if len(prefix) == 0 {
return true
}
if len(path) < len(prefix) {
return false
}
return slices.EqualFunc(path[:len(prefix)], prefix, bytes.Equal)
}