1
0
mirror of https://github.com/sasjs/lint.git synced 2026-01-11 06:20:06 +00:00

chore: getLineNumber utility removed

This commit is contained in:
Saad Jutt
2021-04-07 16:49:24 +05:00
parent 99aec59dd1
commit d317275eb3
6 changed files with 15 additions and 24 deletions

View File

@@ -1,9 +1,7 @@
export const getColumnNumber = (statement: string, text: string): number => {
const index = (statement.split('\n').pop() as string).indexOf(text)
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 statement '${statement}'`
)
throw new Error(`String '${text}' was not found in line '${line}'`)
}
return (statement.split('\n').pop() as string).indexOf(text) + 1
return (line.split('\n').pop() as string).indexOf(text) + 1
}