Skip to content

Commit

Permalink
fix: make filePaths platform agnostic
Browse files Browse the repository at this point in the history
Use `path.sep` as the file separator instead of `/` so that this
works on both Windows and Unix.

Rename input parameter from `path` to `modulePath` so that it
doesn't override `node:path`
  • Loading branch information
sanderson-ut committed Oct 19, 2022
1 parent 7d2642d commit 7b1bc95
Showing 1 changed file with 2 additions and 2 deletions.
4 changes: 2 additions & 2 deletions src/index.ts
Expand Up @@ -250,8 +250,8 @@ const isFile = (path?: string | undefined): path is string => {
}
}

const isModule = (path?: string | undefined): path is string => {
return !!path && isFile(`${path}/package.json`)
const isModule = (modulePath?: string | undefined): modulePath is string => {
return !!modulePath && isFile(`${modulePath}${path.sep}package.json`)
}

/**
Expand Down

0 comments on commit 7b1bc95

Please sign in to comment.