Merge pull request #2255 from vsemozhetbyt/patch-11

Fix semicolons in 1.11.6  (Promisification)
This commit is contained in:
Ilya Kantor 2020-11-10 12:04:26 +03:00 committed by GitHub
commit 2ff5eeb95a
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23

View file

@ -36,11 +36,11 @@ Here it is:
let loadScriptPromise = function(src) {
return new Promise((resolve, reject) => {
loadScript(src, (err, script) => {
if (err) reject(err)
if (err) reject(err);
else resolve(script);
});
})
}
});
};
// usage:
// loadScriptPromise('path/script.js').then(...)
@ -71,7 +71,7 @@ function promisify(f) {
f.call(this, ...args); // call the original function
});
};
};
}
// usage:
let loadScriptPromise = promisify(loadScript);
@ -110,11 +110,11 @@ function promisify(f, manyArgs = false) {
f.call(this, ...args);
});
};
};
}
// usage:
f = promisify(f, true);
f(...).then(arrayOfResults => ..., err => ...)
f(...).then(arrayOfResults => ..., err => ...);
```
As you can see it's essentially the same as above, but `resolve` is called with only one or all arguments depending on whether `manyArgs` is truthy.