MCPcopy
hub / github.com/desktop/desktop / listUnencodedSassVariables

Function listUnencodedSassVariables

script/validate-sass/validate-file.ts:10–44  ·  view source on GitHub ↗
(
  path: string
)

Source from the content-addressed store, hash-verified

8}
9
10export function listUnencodedSassVariables(
11 path: string
12): Promise<ReadonlyArray<SassVariable>> {
13 return new Promise<ReadonlyArray<SassVariable>>((resolve, reject) => {
14 const unencodedVariables = new Array<SassVariable>()
15
16 const lineReader = readline.createInterface({
17 input: fs.createReadStream(path),
18 })
19
20 let lineNumber = 0
21
22 lineReader.on('line', (line: string) => {
23 lineNumber++
24
25 const index = line.indexOf('$', 0)
26
27 if (index > -1) {
28 unencodedVariables.push({
29 fileName: path,
30 lineNumber,
31 text: line,
32 })
33 }
34 })
35
36 lineReader.on('close', () => {
37 resolve(unencodedVariables)
38 })
39
40 lineReader.on('error', (err: Error) => {
41 reject(err)
42 })
43 })
44}

Callers 1

Calls 2

onMethod · 0.65
pushMethod · 0.45

Tested by

no test coverage detected