Write src/engine/execute so it can be optimized

Testing with implicitly casted `value` and `value.then` is deoptimizing
isPromise, which deoptimizes execute. In this case deoptimizing means
that the JavaScript VM cannot compile the functions into a form that
can be run faster.
This commit is contained in:
Michael "Z" Goddard committed 2017-11-06 15:54:22 -05:00
1 parent ef961c5a4b
commit cd9004ce5b
1 file changed
+5 -1
+5 -1
View File
@@ -8,7 +8,11 @@ const {Map} = require('immutable');
* @return {boolean} True if the value appears to be a Promise.
*/
const isPromise = function (value) {
return value && value.then && typeof value.then === 'function';
return (
value !== null &&
typeof value === 'object' &&
typeof value.then === 'function'
);
};
/**