History

Update Git documentation (2.30.0)

Simon Legner committed 5 years ago

Commit 3600a9f1 parent 8f17cfa41 files · +4398 −1Browse files

Showing the changes to node_modules/simple-git/src/util/exists.js (1 of 41 files). Show all

Unified · Split

node_modules/simple-git/src/util/exists.js+33−0
@@ -0,0 +1,33 @@
1+
2+var fs = require('fs');
3+
4+function exists (path, isFile, isDirectory) {
5+ try {
6+ var matches = false;
7+ var stat = fs.statSync(path);
8+
9+ matches = matches || isFile && stat.isFile();
10+ matches = matches || isDirectory && stat.isDirectory();
11+
12+ return matches;
13+ }
14+ catch (e) {
15+ if (e.code === 'ENOENT') {
16+ return false;
17+ }
18+
19+ throw e;
20+ }
21+}
22+
23+module.exports = function (path, type) {
24+ if (!type) {
25+ return exists(path, true, true);
26+ }
27+
28+ return exists(path, type & 1, type & 2);
29+};
30+
31+module.exports.FILE = 1;
32+
33+module.exports.FOLDER = 2;

Keyboard shortcuts

General

Show keyboard shortcuts
?
Focus the current search
/

Issues and pull requests

Open filters
f

Issues, pull requests and Inbox

Select next item
j↓
Select previous item
k↑
Open selected item
Enter
Dismiss filters or clear selection
Esc

Repository code

Go to file
t