Clean up the oopsie. Rebuild the blank exercises.

This commit is contained in:
Michael Frank
2021-05-09 00:39:21 +12:00
parent b984cb4c6f
commit d28d80c46f
1565 changed files with 27186 additions and 199003 deletions
+15 -16
View File
@@ -1,24 +1,23 @@
'use strict';
var fs = require('fs');
var Promise = require('pinkie-promise');
const fs = require('fs');
const {promisify} = require('util');
module.exports = function (fp) {
var fn = typeof fs.access === 'function' ? fs.access : fs.stat;
return new Promise(function (resolve) {
fn(fp, function (err) {
resolve(!err);
});
});
};
module.exports.sync = function (fp) {
var fn = typeof fs.accessSync === 'function' ? fs.accessSync : fs.statSync;
const pAccess = promisify(fs.access);
module.exports = async path => {
try {
fn(fp);
await pAccess(path);
return true;
} catch (err) {
} catch (_) {
return false;
}
};
module.exports.sync = path => {
try {
fs.accessSync(path);
return true;
} catch (_) {
return false;
}
};