MCPcopy Create free account
hub / github.com/Effect-TS/effect / takeLine

Function takeLine

packages/effect/src/encoding/Ndjson.ts:358–370  ·  view source on GitHub ↗
(chunk: Uint8Array, start: number, end: number)

Source from the content-addressed store, hash-verified

356 let afterCR = false
357
358 const takeLine = (chunk: Uint8Array, start: number, end: number): Uint8Array => {
359 if (pendingBytes === 0) return chunk.subarray(start, end)
360 const line = new Uint8Array(pendingBytes + end - start)
361 let offset = 0
362 for (const bytes of pending) {
363 line.set(bytes, offset)
364 offset += bytes.length
365 }
366 line.set(chunk.subarray(start, end), offset)
367 pending = []
368 pendingBytes = 0
369 return line
370 }
371
372 const decodeLine = (bytes: Uint8Array, out: Array<unknown>, unterminated: boolean) => {
373 let line: string

Callers 2

stepFunction · 0.85
flushFunction · 0.85

Calls 1

setMethod · 0.65

Tested by

no test coverage detected