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 (3 of 41 files). Show all

Unified · Split

3 files
  1. node_modules/simple-git/src/util/deferred.js +10 −0
  2. node_modules/simple-git/src/util/dependencies.js +12 −0
  3. node_modules/simple-git/src/util/exists.js +33 −0
node_modules/simple-git/src/util/deferred.js+10−0
@@ -0,0 +1,10 @@
1
2module.exports = function deferred () {
3 var d = {};
4 d.promise = new Promise(function (resolve, reject) {
5 d.resolve = resolve;
6 d.reject = reject
7 });
8
9 return d;
10};
node_modules/simple-git/src/util/dependencies.js+12−0
@@ -0,0 +1,12 @@
1/**
2 * Exports the utilities `simple-git` depends upon to allow for mocking during a test
3 */
4module.exports = {
5
6 buffer: function () { return require('buffer').Buffer; },
7
8 childProcess: function () { return require('child_process'); },
9
10 exists: require('./exists')
11
12};
node_modules/simple-git/src/util/exists.js+33−0
@@ -0,0 +1,33 @@
1
2var fs = require('fs');
3
4function 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
23module.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
31module.exports.FILE = 1;
32
33module.exports.FOLDER = 2;