| Server IP : 217.160.0.212 / Your IP : 216.73.216.141 Web Server : Apache System : Linux www 6.18.51-i1-ampere #1196 SMP Fri Sep 11 20:43:55 CEST 2026 aarch64 User : sws1073854427 ( 1073854427) PHP Version : 8.4.23 Disable Function : NONE MySQL : OFF | cURL : ON | WGET : ON | Perl : ON | Python : OFF | Sudo : OFF | Pkexec : OFF Directory : /usr/share/node_modules/release-zalgo/lib/ |
Upload File : |
'use strict'
const constants = require('./constants')
const unwrapSync = require('./unwrapSync')
// Behaves like a Promise, though the then() and catch() methods are unbound and
// must be called with the instance as their thisArg.
//
// The executor must either return a value or throw a rejection reason. It is
// not provided resolver or rejecter methods. The executor may return another
// thenable.
class Thenable {
constructor (executor) {
try {
this.result = unwrapSync(executor())
this.state = constants.RESOLVED
} catch (err) {
this.result = err
this.state = constants.REJECTED
}
}
then (onFulfilled, onRejected) {
if (this.state === constants.RESOLVED && typeof onFulfilled === 'function') {
return new Thenable(() => onFulfilled(this.result))
}
if (this.state === constants.REJECTED && typeof onRejected === 'function') {
return new Thenable(() => onRejected(this.result))
}
return this
}
catch (onRejected) {
return this.then(null, onRejected)
}
}
module.exports = Thenable