Merge pull request #765 from mzgoddard/execute-is-promise-deopt

Write src/engine/execute so it can be optimized
This commit is contained in:
Ray Schamp 2017-11-07 12:19:58 -05:00 committed by GitHub
commit b07bbd4745
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23

View file

@ -15,7 +15,11 @@ const blockUtility = new BlockUtility();
* @return {boolean} True if the value appears to be a Promise. * @return {boolean} True if the value appears to be a Promise.
*/ */
const isPromise = function (value) { const isPromise = function (value) {
return value && value.then && typeof value.then === 'function'; return (
value !== null &&
typeof value === 'object' &&
typeof value.then === 'function'
);
}; };
/** /**