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

Function onEachLine

npm_modules/cli/test/helpers/StreamHelpers.ts:28–37  ·  view source on GitHub ↗
(
  fn: (line: Buffer) => void,
)

Source from the content-addressed store, hash-verified

26 * The input/output is not changed and cannot be mutated by the callback.
27 */
28export function onEachLine(
29 fn: (line: Buffer) => void,
30): (source: AsyncGenerator<Buffer | string>) => AsyncGenerator<string | Buffer> {
31 return async function* (source) {
32 for await (const line of pipeEachLine(source)) {
33 fn(typeof line === 'string' ? Buffer.from(line) : line);
34 yield line;
35 }
36 };
37}

Callers 1

monitorFunction · 0.90

Calls 3

pipeEachLineFunction · 0.85
fnFunction · 0.50
fromMethod · 0.45

Tested by

no test coverage detected