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

fix: check tab indentation in whole line

This commit is contained in:
2022-12-09 16:36:09 +05:00
parent 8be59ac591
commit 3701253302
8 changed files with 163 additions and 116 deletions

26
src/utils/getIndicesOf.ts Normal file
View File

@@ -0,0 +1,26 @@
export const getIndicesOf = (
searchStr: string,
str: string,
caseSensitive: boolean = true
) => {
const searchStrLen = searchStr.length
if (searchStrLen === 0) {
return []
}
let startIndex = 0,
index,
indices = []
if (!caseSensitive) {
str = str.toLowerCase()
searchStr = searchStr.toLowerCase()
}
while ((index = str.indexOf(searchStr, startIndex)) > -1) {
indices.push(index)
startIndex = index + searchStrLen
}
return indices
}

View File

@@ -4,3 +4,4 @@ export * from './getProjectRoot'
export * from './isIgnored'
export * from './listSasFiles'
export * from './splitText'
export * from './getIndicesOf'