Skip to content

Commit

Permalink
Fix lint
Browse files Browse the repository at this point in the history
  • Loading branch information
richfitz committed Aug 9, 2023
1 parent 704337c commit 7705c04
Showing 1 changed file with 13 additions and 13 deletions.
26 changes: 13 additions & 13 deletions app/server/src/configReader.ts
Original file line number Diff line number Diff line change
@@ -1,6 +1,19 @@
import * as fs from "fs";
import * as path from "path";

export function stripBom(str: string): string {
// Catches EFBBBF (UTF-8 BOM) because the buffer-to-string
// conversion translates it to FEFF (UTF-16 BOM).
if (str.charCodeAt(0) === 0xFEFF) {
return str.slice(1);
}
return str;
}

export function readFile(filename: string): string {
return stripBom(fs.readFileSync(filename, { encoding: "utf-8" }));
}

export class ConfigReader {
rootDir: string;

Expand All @@ -21,16 +34,3 @@ export class ConfigReader {
return null;
}
}

export function stripBom(str: string): string {
// Catches EFBBBF (UTF-8 BOM) because the buffer-to-string
// conversion translates it to FEFF (UTF-16 BOM).
if (str.charCodeAt(0) === 0xFEFF) {
return str.slice(1);
}
return str;
}

export function readFile(filename: string): string {
return stripBom(fs.readFileSync(filename, { encoding: "utf-8" }));
}

0 comments on commit 7705c04

Please sign in to comment.