Avoid the release of Zalgo (#1295)

This commit is contained in:
Tomas Della Vedova
2020-09-10 15:27:27 +02:00
committed by delvedor
parent f02567491f
commit 584a8799d8
4 changed files with 105 additions and 19 deletions

View File

@ -664,7 +664,10 @@ function ESAPI (opts) {
return apis
function handleError (err, callback) {
if (callback) return callback(err, result)
if (callback) {
process.nextTick(callback, err, result)
return { then: noop, catch: noop, abort: noop }
}
return Promise.reject(err)
}
@ -699,4 +702,6 @@ function lazyLoad (file, opts) {
}
}
function noop () {}
module.exports = ESAPI