☕️ Classic, reliable, trusted test framework for Node.js and the browser
Merge pull request #1761 from chromakode/explicit-null-and-defined
Joshua Appelmanfc3fee6bfcb2
diff --cc lib/utils.jsindex 8ef13321,5eb2b92d..7e102ee1--- a/lib/utils.js+++ b/lib/utils.js@@@ -380,9 -367,16 +380,13 @@@ function emptyRepresentation(value, typ* type(/foo/) // 'regexp'* type('type') // 'string'* type(global) // 'global'- * @api private- * @see https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Object/toString- * @returns {string}*/exports.type = function type(value) {- if (typeof Buffer !== 'undefined' && Buffer.isBuffer(value)) {+ if (value === undefined) {+ return 'undefined';+ } else if (value === null) {+ return 'null';+ } else if (typeof Buffer !== 'undefined' && Buffer.isBuffer(value)) {return 'buffer';}return Object.prototype.toString.call(value)