Skip to content

Commit

Permalink
refactor: improve object.is
Browse files Browse the repository at this point in the history
  • Loading branch information
medikoo committed Apr 2, 2019
1 parent 527c0b9 commit 6e3aa0b
Showing 1 changed file with 4 additions and 2 deletions.
6 changes: 4 additions & 2 deletions object/is.js
Expand Up @@ -2,8 +2,10 @@

var isValue = require("../value/is");

// prettier-ignore
var possibleTypes = { "object": true, "function": true, "undefined": true /* document.all */ };

module.exports = function (value) {
if (!isValue(value)) return false;
var type = typeof value;
return type === "object" || type === "function" || type === "undefined"; // document.all
return hasOwnProperty.call(possibleTypes, typeof value);
};

0 comments on commit 6e3aa0b

Please sign in to comment.