MCPcopy Index your code
hub / github.com/parse-community/parse-server / isPromise

Method isPromise

src/Utils.js:175–180  ·  view source on GitHub ↗

* 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)

Source from the content-addressed store, hash-verified

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`

Callers 4

runMethod · 0.80
isValidSimpleObjectFunction · 0.80
pageResponseMethod · 0.80
Utils.spec.jsFile · 0.80

Calls

no outgoing calls

Tested by

no test coverage detected