From 5d57d74d98c21ab528e44002560d57255afae1ab Mon Sep 17 00:00:00 2001 From: Zachary Golba Date: Sun, 11 Sep 2016 16:15:55 -0400 Subject: [PATCH 1/2] fix: isFilePath not working on windows --- src/index.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/index.js b/src/index.js index 4f0fd28..f215afd 100644 --- a/src/index.js +++ b/src/index.js @@ -5,7 +5,7 @@ import fs from 'fs'; const noop = () => null; const startsWith = (needle, haystack) => ! haystack.indexOf(needle); const endsWith = (needle, haystack) => haystack.slice(-needle.length) === needle; -const isFilePath = id => /^\.?\//.test(id); +const isFilePath = id => new RegExp(`^\.?\\${path.sep}`).test(id); const exists = uri => { try { return fs.statSync(uri).isFile(); From 6f1f48422acea0e2c62affc3d27b8fd28a8e11a1 Mon Sep 17 00:00:00 2001 From: Zachary Golba Date: Sun, 18 Sep 2016 18:07:21 -0400 Subject: [PATCH 2/2] fix: missing backslash causing test to fail --- src/index.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/index.js b/src/index.js index f215afd..50d14e0 100644 --- a/src/index.js +++ b/src/index.js @@ -5,7 +5,7 @@ import fs from 'fs'; const noop = () => null; const startsWith = (needle, haystack) => ! haystack.indexOf(needle); const endsWith = (needle, haystack) => haystack.slice(-needle.length) === needle; -const isFilePath = id => new RegExp(`^\.?\\${path.sep}`).test(id); +const isFilePath = id => new RegExp(`^\\.?\\${path.sep}`).test(id); const exists = uri => { try { return fs.statSync(uri).isFile();