MCPcopy Index your code
hub / github.com/wavetermdev/waveterm / EncodedStringArrayHasFirstVal

Function EncodedStringArrayHasFirstVal

pkg/util/utilfn/utilfn.go:459–468  ·  view source on GitHub ↗
(encoded []byte, firstKey string)

Source from the content-addressed store, hash-verified

457}
458
459func EncodedStringArrayHasFirstVal(encoded []byte, firstKey string) bool {
460 firstKeyBytes := NullEncodeStr(firstKey)
461 if !bytes.HasPrefix(encoded, firstKeyBytes) {
462 return false
463 }
464 if len(encoded) == len(firstKeyBytes) || encoded[len(firstKeyBytes)] == nullEncodeSepByte {
465 return true
466 }
467 return false
468}
469
470// on encoding error returns ""
471// this is used to perform logic on first value without decoding the entire array

Callers

nothing calls this directly

Calls 1

NullEncodeStrFunction · 0.85

Tested by

no test coverage detected