Prettify everything

This commit is contained in:
MICHAEL JACKSON
2018-02-17 18:00:56 -08:00
parent d6f2bc089a
commit 2e1f09e913
58 changed files with 1061 additions and 932 deletions

View File

@ -1,24 +1,24 @@
function createMutex(doWork) {
const mutex = {}
const mutex = {};
return function(key, payload, callback) {
if (mutex[key]) {
mutex[key].push(callback)
mutex[key].push(callback);
} else {
mutex[key] = [
function() {
delete mutex[key]
delete mutex[key];
},
callback
]
];
doWork(payload, function(error, value) {
mutex[key].forEach(callback => {
callback(error, value)
})
})
callback(error, value);
});
});
}
}
};
}
module.exports = createMutex
module.exports = createMutex;