Skip to content

Commit

Permalink
Merge f6d0372 into 6df0e84
Browse files Browse the repository at this point in the history
  • Loading branch information
fabiosantoscode committed Dec 11, 2018
2 parents 6df0e84 + f6d0372 commit c2f86de
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 1 deletion.
6 changes: 5 additions & 1 deletion lib/utils.js
Expand Up @@ -688,7 +688,11 @@ exports.stackTraceFilter = function() {
* @returns {boolean} Whether or not `value` is a Promise
*/
exports.isPromise = function isPromise(value) {
return typeof value === 'object' && typeof value.then === 'function';
return (
typeof value === 'object' &&
value !== null &&
typeof value.then === 'function'
);
};

/**
Expand Down
4 changes: 4 additions & 0 deletions test/unit/utils.spec.js
Expand Up @@ -591,6 +591,10 @@ describe('lib/utils', function() {
it('should return false if the value is an object w/o a "then" function', function() {
expect(utils.isPromise({}), 'to be', false);
});

it('should return false if the object is null', function() {
expect(utils.isPromise(null), 'to be', false);
});
});

describe('escape', function() {
Expand Down

0 comments on commit c2f86de

Please sign in to comment.