From 7b1bc9565033633cec33f56dc9dd3f90bd819ae5 Mon Sep 17 00:00:00 2001 From: Scott Anderson Date: Wed, 19 Oct 2022 11:12:45 +0100 Subject: [PATCH] fix: make filePaths platform agnostic 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` --- src/index.ts | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/index.ts b/src/index.ts index 5ce76fe..485992c 100644 --- a/src/index.ts +++ b/src/index.ts @@ -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`) } /**