Skip to content

Commit 0e76875

Browse files
jonschlinkertphated
authored andcommitted
Update: Use fs-exists-sync instead of try-open
1 parent 31e9a21 commit 0e76875

File tree

2 files changed

+7
-9
lines changed

2 files changed

+7
-9
lines changed

index.js

Lines changed: 3 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
const fs = require('fs');
2-
const tryOpen = require('try-open');
2+
const exists = require('fs-exists-sync');
33

44
function isEmpty(path, fn, callback) {
55
if (arguments.length === 2) {
@@ -24,7 +24,7 @@ function isEmpty(path, fn, callback) {
2424

2525
callback(null, files.length === 0);
2626
});
27-
};
27+
}
2828

2929
isEmpty.sync = function(path, fn) {
3030
if (!exists(path)) {
@@ -36,12 +36,8 @@ isEmpty.sync = function(path, fn) {
3636
files = files.filter(fn);
3737
}
3838
return files.length === 0;
39-
} catch (err) {};
39+
} catch (err) {}
4040
return false;
4141
};
4242

43-
function exists(path) {
44-
return path && typeof tryOpen(path, 'r') === 'number';
45-
}
46-
4743
module.exports = isEmpty;

package.json

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -10,15 +10,17 @@
1010
},
1111
"license": "MIT",
1212
"main": "index.js",
13-
"files": ["index.js"],
13+
"files": [
14+
"index.js"
15+
],
1416
"engines": {
1517
"node": ">= 0.8.0"
1618
},
1719
"scripts": {
1820
"test": "mocha"
1921
},
2022
"dependencies": {
21-
"try-open": "^0.1.0"
23+
"fs-exists-sync": "^0.1.0"
2224
},
2325
"devDependencies": {
2426
"chai": "~1.9.1",

0 commit comments

Comments
 (0)