MCPcopy Create free account
hub / github.com/TypeStrong/tsify / countLinesUntil

Function countLinesUntil

test/test.js:797–804  ·  view source on GitHub ↗
(str, index)

Source from the content-addressed store, hash-verified

795}
796
797function countLinesUntil(str, index) {
798 var count = 1;
799 while ((index = str.lastIndexOf('\n', index)) !== -1) {
800 ++count;
801 --index;
802 }
803 return count;
804}
805
806function indexToLineAndColumn(src, index) {
807 var indexOfLine = src.lastIndexOf('\n', index-1) + 1;

Callers 1

indexToLineAndColumnFunction · 0.85

Calls

no outgoing calls

Tested by

no test coverage detected