]> git.lizzy.rs Git - rust.git/commitdiff
Remove trivial helpers
authorAleksey Kladov <aleksey.kladov@gmail.com>
Tue, 31 Dec 2019 01:21:57 +0000 (02:21 +0100)
committerAleksey Kladov <aleksey.kladov@gmail.com>
Tue, 31 Dec 2019 01:21:57 +0000 (02:21 +0100)
editors/code/src/scopes.ts

index cb250b853ad0ecf50e721fdd441a4a73ea7a64e0..46555633300d769694e08717d09c7f58b0ea64a4 100644 (file)
@@ -82,9 +82,9 @@ function loadThemeNamed(themeName: string) {
 
 function loadThemeFile(themePath: string) {
     const themeContent = [themePath]
-        .filter(isFile)
-        .map(readFileText)
-        .map(parseJSON)
+        .filter(it => fs.statSync(it).isFile())
+        .map(it => fs.readFileSync(it, 'utf8'))
+        .map(it => jsonc.parse(it))
         .filter(theme => theme);
 
     themeContent
@@ -132,15 +132,3 @@ function loadColors(textMateRules: TextMateRule[]): void {
         }
     });
 }
-
-function isFile(filePath: string): boolean {
-    return [filePath].map(fs.statSync).every(stat => stat.isFile());
-}
-
-function readFileText(filePath: string): string {
-    return fs.readFileSync(filePath, 'utf8');
-}
-
-function parseJSON(content: string): any {
-    return jsonc.parse(content);
-}