in src/utils.js [54:67]
function getLocFromIndex(sourceCode, index) {
if (sourceCode.getLocFromIndex) {
return sourceCode.getLocFromIndex(index);
}
let pos = 0;
for (let line = 0; line < sourceCode.lines.length; line++) {
const lineLength = sourceCode.lines[line].length;
if (index <= pos + lineLength) {
return {line: line + 1, column: index - pos};
}
pos += lineLength + 1;
}
return null;
}