MCPcopy Create free account
hub / github.com/Snapchat/Valdi / parseHeaders

Function parseHeaders

npm_modules/cli/test/helpers/TypeScriptClient.ts:145–152  ·  view source on GitHub ↗
(chunk: Buffer)

Source from the content-addressed store, hash-verified

143}
144
145function* parseHeaders(chunk: Buffer): Generator<[name: string, value: string]> {
146 for (const line of eachLine(chunk)) {
147 const sep = line.indexOf(':');
148 const name = line.subarray(0, sep);
149 const value = line.subarray(sep + 1);
150 yield [name.toString('utf8'), value.toString('utf8').trim()];
151 }
152}
153
154/**
155 * Create a statefull message buffer that parses TSServer messages.

Callers 1

createMessageBufferFunction · 0.85

Calls 4

eachLineFunction · 0.70
toStringMethod · 0.65
indexOfMethod · 0.45
trimMethod · 0.45

Tested by

no test coverage detected