use directories for structure

This commit is contained in:
s2
2020-05-26 10:37:57 +02:00
parent 66580d4847
commit ae4aaf2668
1287 changed files with 92093 additions and 13113 deletions

View File

@@ -1,17 +1,13 @@
'use strict';
const success = (a) => [null, a];
const fail = (a) => [a];
const noArg = (f, a) => () => f(...a);
module.exports = (fn, ...args) => {
module.exports = async (fn, ...args) => {
check(fn);
return Promise.resolve()
.then(noArg(fn, args))
.then(success)
.catch(fail);
try {
return [null, await fn(...args)];
} catch(e) {
return [e];
}
};
function check(fn) {