mirror of
https://github.com/knex/knex.git
synced 2025-07-04 07:26:21 +00:00
14 lines
470 B
JavaScript
14 lines
470 B
JavaScript
![]() |
const noop = require('./noop');
|
||
|
|
||
|
const finallyMixin = (prototype) =>
|
||
|
Object.assign(prototype, {
|
||
|
finally(onFinally) {
|
||
|
return this.then().finally(onFinally);
|
||
|
},
|
||
|
});
|
||
|
|
||
|
// FYI: Support for `Promise.prototype.finally` was not introduced until Node 9.
|
||
|
// Therefore, Knex will need to conditionally inject support for `.finally(..)`
|
||
|
// until support for Node 8 is officially dropped.
|
||
|
module.exports = Promise.prototype.finally ? noop : finallyMixin;
|