* Realm-safe check for Promise (duck-typed as thenable). * Guards against Object.prototype pollution by ensuring `then` is not * inherited solely from Object.prototype. * @param {any} value The value to check. * @returns {Boolean} Returns true if the value is a Promise or thenable.
(value)
| 173 | * @returns {Boolean} Returns true if the value is a Promise or thenable. |
| 174 | */ |
| 175 | static isPromise(value) { |
| 176 | if (value == null || typeof value.then !== 'function') { |
| 177 | return false; |
| 178 | } |
| 179 | return Object.getPrototypeOf(value) !== Object.prototype || Object.prototype.hasOwnProperty.call(value, 'then'); |
| 180 | } |
| 181 | |
| 182 | /** |
| 183 | * Realm-safe check for object type. Uses `typeof` instead of `instanceof Object` |
no outgoing calls
no test coverage detected