From 4a6b9cb0161817964a3a6fd56cc590eaca4fc40a Mon Sep 17 00:00:00 2001 From: Ashish Surana Date: Sat, 6 Oct 2018 13:54:25 +0530 Subject: [PATCH] refactor: rename function to camel case (#1053) - changing function folder_exists to folderExists --- src/lib/config-path.js | 8 ++++---- src/lib/utils.js | 4 ++-- 2 files changed, 6 insertions(+), 6 deletions(-) diff --git a/src/lib/config-path.js b/src/lib/config-path.js index 258bb8c88..6a12e0a0e 100644 --- a/src/lib/config-path.js +++ b/src/lib/config-path.js @@ -6,7 +6,7 @@ import Path from 'path'; import logger from './logger'; import mkdirp from 'mkdirp'; -import {folder_exists, fileExists} from './utils'; +import {folderExists, fileExists} from './utils'; const CONFIG_FILE = 'config.yaml'; const XDG = 'xdg'; @@ -65,7 +65,7 @@ function updateStorageLinks(configLocation, defaultConfig) { // If $XDG_DATA_HOME is either not set or empty, a default equal to $HOME/.local/share should be used. // $FlowFixMe let dataDir = process.env.XDG_DATA_HOME || Path.join(process.env.HOME, '.local', 'share'); - if (folder_exists(dataDir)) { + if (folderExists(dataDir)) { dataDir = Path.resolve(Path.join(dataDir, pkgJSON.name, 'storage')); return defaultConfig.replace(/^storage: .\/storage$/m, `storage: ${dataDir}`); } else { @@ -81,7 +81,7 @@ const getXDGDirectory = () => { const XDGConfig = getXDGHome() || process.env.HOME && Path.join(process.env.HOME, '.config'); - if (XDGConfig && folder_exists(XDGConfig)) { + if (XDGConfig && folderExists(XDGConfig)) { return { path: Path.join(XDGConfig, pkgJSON.name, CONFIG_FILE), type: XDG, @@ -92,7 +92,7 @@ const getXDGDirectory = () => { const getXDGHome = () => process.env.XDG_CONFIG_HOME; const getWindowsDirectory = () => { - if (process.platform === WIN32 && process.env.APPDATA && folder_exists(process.env.APPDATA)) { + if (process.platform === WIN32 && process.env.APPDATA && folderExists(process.env.APPDATA)) { return { path: Path.resolve(Path.join(process.env.APPDATA, pkgJSON.name, CONFIG_FILE)), type: WIN, diff --git a/src/lib/utils.js b/src/lib/utils.js index 1deba686a..7c218798b 100644 --- a/src/lib/utils.js +++ b/src/lib/utils.js @@ -431,7 +431,7 @@ const parseConfigFile = (configPath: string) => * @param {String} path * @return {Boolean} */ -function folder_exists(path: string) { +function folderExists(path: string) { try { const stat = fs.statSync(path); return stat.isDirectory(); @@ -550,7 +550,7 @@ export { deleteProperties, addScope, sortByName, - folder_exists, + folderExists, fileExists, parseInterval, semverSort,