Pattern: Non-standard Promise
constructor parameter names
Issue: -
The Promise
constructor follows the RevealingConstructor pattern with standard parameter names resolve
and reject
. Using different names or incorrect ordering can make code harder to understand and less consistent with the language specification.
Example of incorrect code:
new Promise(function (reject, resolve) {
/* ... */
}); // incorrect order
new Promise(function (ok, fail) {
/* ... */
}); // non-standard parameter names
Example of correct code:
new Promise(function (resolve, reject) {});