in packages/mysql/lib/mysql_p.js [36:47]
function isPromise(maybePromise) {
if (maybePromise != null && maybePromise.then instanceof Function) {
// mysql2 has a `Query` class with a `then` method which always throws an error when called.
// We want to avoid calling this, so we need to check for more than just the presence of a `then` method.
// See https://github.com/sidorares/node-mysql2/blob/dbb344e89a1cc8bb457b24e67b07cdb3013fe844/lib/commands/query.js#L38-L44
// Since it's highly unlikely that any Promise implementation would name their class `Query`,
// we can safely use this to determine whether or not this is actually a Promise.
const constructorName = maybePromise.constructor != null ? maybePromise.constructor.name : undefined;
return constructorName !== 'Query';
}
return false;
}