UNPKG

283 BJavaScriptView Raw
1"use strict";
2
3Object.defineProperty(exports, "__esModule", {
4 value: true
5});
6exports.default = countLines;
7
8function countLines(string) {
9 let lines = 1;
10
11 for (let i = 0; i < string.length; i++) {
12 if (string.charAt(i) === '\n') {
13 lines++;
14 }
15 }
16
17 return lines;
18}
\No newline at end of file