(text: string)
| 669 | } |
| 670 | |
| 671 | function 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 | |
| 682 | function mapStatError(err: unknown, inputPath: string): Error { |
| 683 | const code = (err as NodeJS.ErrnoException).code; |