Skip to content

Commit

Permalink
refactor ~ extract common module reference
Browse files Browse the repository at this point in the history
  • Loading branch information
rivy committed Jan 1, 2021
1 parent e591e96 commit 5ce6945
Showing 1 changed file with 2 additions and 4 deletions.
6 changes: 2 additions & 4 deletions src/lib/OSPaths.ts
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,8 @@ export type OSPaths = {
readonly temp: () => string;
};

const { env } = process;

const isWinOS = /^win/i.test(process.platform);

function isEmpty(s: string | null | undefined): boolean {
Expand All @@ -21,8 +23,6 @@ function normalizePath(path_: string | undefined): string | undefined {
}

const base = () => {
const { env } = process;

const home = () =>
normalizePath((typeof os.homedir === 'function' ? os.homedir() : void 0) || env.HOME);

Expand All @@ -41,8 +41,6 @@ const base = () => {
};

const windows = () => {
const { env } = process;

const home = () => {
const priorityList = [
typeof os.homedir === 'function' ? os.homedir() : void 0,
Expand Down

0 comments on commit 5ce6945

Please sign in to comment.