MCPcopy Index your code
hub / github.com/microsoft/typescript-go / encodeStringArray

Function encodeStringArray

internal/api/encoder/encoder.go:744–754  ·  view source on GitHub ↗

encodeStringArray encodes a slice of strings as a msgpack array of strings. Returns the byte offset into the buffer, or noStructuredData if the slice is empty.

(strs []string, buf *[]byte)

Source from the content-addressed store, hash-verified

742// encodeStringArray encodes a slice of strings as a msgpack array of strings.
743// Returns the byte offset into the buffer, or noStructuredData if the slice is empty.
744func encodeStringArray(strs []string, buf *[]byte) uint32 {
745 if len(strs) == 0 {
746 return noStructuredData
747 }
748 offset := uint32(len(*buf))
749 *buf = msgpackWriteArrayHeader(*buf, len(strs))
750 for _, s := range strs {
751 *buf = msgpackWriteString(*buf, s)
752 }
753 return offset
754}
755
756// Minimal msgpack writers for the structured data section.
757

Callers 1

encodeTreeFunction · 0.85

Calls 3

lenFunction · 0.85
msgpackWriteArrayHeaderFunction · 0.85
msgpackWriteStringFunction · 0.85

Tested by

no test coverage detected