Fix FileUtils promises

This commit is contained in:
Samuel Elliott 2018-01-25 16:47:13 +00:00
parent 65cf800283
commit d11cfbcdaa
No known key found for this signature in database
GPG Key ID: 8420C7CDE43DC4D6
1 changed files with 7 additions and 7 deletions

View File

@ -5,7 +5,7 @@
* https://github.com/JsSucks - https://betterdiscord.net
*
* This source code is licensed under the MIT license found in the
* LICENSE file in the root directory of this source tree.
* LICENSE file in the root directory of this source tree.
*/
const { Module } = require('./modulebase');
@ -78,7 +78,7 @@ class Utils {
});
}
}
}
class FileUtils {
@ -102,7 +102,7 @@ class FileUtils {
}
static async directoryExists(path) {
return new Promise(resolve => {
return new Promise((resolve, reject) => {
fs.stat(path, (err, stats) => {
if (err) return reject({
'message': `Directory does not exist: ${path}`,
@ -126,7 +126,7 @@ class FileUtils {
throw (err);
}
return new Promise(resolve => {
return new Promise((resolve, reject) => {
fs.readFile(path, 'utf-8', (err, data) => {
if (err) reject({
'message': `Could not read file: ${path}`,
@ -208,17 +208,17 @@ class Filters {
};
}
static byDisplayName(name) {
static byDisplayName(name) {
return module => {
return module && module.displayName === name;
};
}
static combine(...filters) {
static combine(...filters) {
return module => {
return filters.every(filter => filter(module));
};
}
};
module.exports = { Logger, Utils, FileUtils, Filters }
module.exports = { Logger, Utils, FileUtils, Filters };