MCPcopy Create free account
hub / github.com/CodeForBreakfast/eventsourcing / extractCodeBlocks

Function extractCodeBlocks

scripts/validate-markdown-examples.ts:127–134  ·  view source on GitHub ↗
(content: string, filePath: string)

Source from the content-addressed store, hash-verified

125
126const reduceLineToParserState =
127 (filePath: string) =>
128 (accEffect: Effect.Effect<ParserState, never, never>, line: string, index: number) =>
129 pipe(accEffect, flatMapProcessLine(filePath, index, line));
130
131const extractCodeBlocks = (content: string, filePath: string) => {
132 const lines = content.split('\n');
133 return pipe(
134 lines,
135 EffectArray.reduce(Effect.succeed(initialParserState), reduceLineToParserState(filePath)),
136 Effect.flatMap(finalizeParserState(filePath))
137 );

Callers 1

readAndExtractCodeBlocksFunction · 0.85

Calls 2

reduceLineToParserStateFunction · 0.85
finalizeParserStateFunction · 0.85

Tested by

no test coverage detected