MCPcopy Create free account
hub / github.com/MoonshotAI/kimi-code / countLines

Function countLines

packages/agent-core/src/services/fs/fsService.ts:671–680  ·  view source on GitHub ↗
(text: string)

Source from the content-addressed store, hash-verified

669}
670
671function countLines(text: string): number {
672 if (text.length === 0) return 0;
673 let n = 1;
674 for (let i = 0; i < text.length; i++) {
675 if (text.charCodeAt(i) === 10) n++;
676 }
677
678 if (text.charCodeAt(text.length - 1) === 10) n--;
679 return Math.max(0, n);
680}
681
682function mapStatError(err: unknown, inputPath: string): Error {
683 const code = (err as NodeJS.ErrnoException).code;

Callers 1

readMethod · 0.85

Calls

no outgoing calls

Tested by

no test coverage detected