1
0
mirror of https://github.com/laurent22/joplin.git synced 2024-12-12 08:54:00 +02:00
joplin/ReactNativeClient/lib/promise-utils.js

13 lines
269 B
JavaScript

function promiseChain(chain, defaultValue = null) {
let output = new Promise((resolve) => {
resolve(defaultValue);
});
for (let i = 0; i < chain.length; i++) {
let f = chain[i];
output = output.then(f);
}
return output;
}
module.exports = { promiseChain };