mirror of
https://github.com/sasjs/lint.git
synced 2025-12-10 17:34:36 +00:00
8 lines
297 B
TypeScript
8 lines
297 B
TypeScript
export const getColumnNumber = (line: string, text: string): number => {
|
|
const index = (line.split('\n').pop() as string).indexOf(text)
|
|
if (index < 0) {
|
|
throw new Error(`String '${text}' was not found in line '${line}'`)
|
|
}
|
|
return (line.split('\n').pop() as string).indexOf(text) + 1
|
|
}
|