mirror of
https://github.com/SamEyeBam/animate.git
synced 2025-09-28 06:55:25 +00:00
16 lines
266 B
JavaScript
16 lines
266 B
JavaScript
// @flow strict-local
|
|
|
|
export default function countLines(
|
|
string: string,
|
|
startIndex: number = 0,
|
|
): number {
|
|
let lines = 1;
|
|
for (let i = startIndex; i < string.length; i++) {
|
|
if (string.charAt(i) === '\n') {
|
|
lines++;
|
|
}
|
|
}
|
|
|
|
return lines;
|
|
}
|