Skip to content

Commit

Permalink
[Fix] Functions are objects.
Browse files Browse the repository at this point in the history
Fixes #418.
  • Loading branch information
ljharb committed May 12, 2016
1 parent 3b3f7ac commit c3ca579
Showing 1 changed file with 6 additions and 7 deletions.
13 changes: 6 additions & 7 deletions es6-shim.js
Original file line number Diff line number Diff line change
Expand Up @@ -243,7 +243,6 @@

var Type = {
primitive: function (x) { return x === null || (typeof x !== 'function' && typeof x !== 'object'); },
object: function (x) { return x !== null && typeof x === 'object'; },
string: function (x) { return _toString(x) === '[object String]'; },
regex: function (x) { return _toString(x) === '[object RegExp]'; },
symbol: function (x) {
Expand Down Expand Up @@ -1653,7 +1652,7 @@
if (!objectSealAcceptsPrimitives) {
var originalObjectSeal = Object.seal;
overrideNative(Object, 'seal', function seal(value) {
if (!Type.object(value)) { return value; }
if (!ES.TypeIsObject(value)) { return value; }
return originalObjectSeal(value);
});
}
Expand All @@ -1663,7 +1662,7 @@
if (!objectIsSealedAcceptsPrimitives) {
var originalObjectIsSealed = Object.isSealed;
overrideNative(Object, 'isSealed', function isSealed(value) {
if (!Type.object(value)) { return true; }
if (!ES.TypeIsObject(value)) { return true; }
return originalObjectIsSealed(value);
});
}
Expand All @@ -1673,7 +1672,7 @@
if (!objectFreezeAcceptsPrimitives) {
var originalObjectFreeze = Object.freeze;
overrideNative(Object, 'freeze', function freeze(value) {
if (!Type.object(value)) { return value; }
if (!ES.TypeIsObject(value)) { return value; }
return originalObjectFreeze(value);
});
}
Expand All @@ -1683,7 +1682,7 @@
if (!objectIsFrozenAcceptsPrimitives) {
var originalObjectIsFrozen = Object.isFrozen;
overrideNative(Object, 'isFrozen', function isFrozen(value) {
if (!Type.object(value)) { return true; }
if (!ES.TypeIsObject(value)) { return true; }
return originalObjectIsFrozen(value);
});
}
Expand All @@ -1693,7 +1692,7 @@
if (!objectPreventExtensionsAcceptsPrimitives) {
var originalObjectPreventExtensions = Object.preventExtensions;
overrideNative(Object, 'preventExtensions', function preventExtensions(value) {
if (!Type.object(value)) { return value; }
if (!ES.TypeIsObject(value)) { return value; }
return originalObjectPreventExtensions(value);
});
}
Expand All @@ -1703,7 +1702,7 @@
if (!objectIsExtensibleAcceptsPrimitives) {
var originalObjectIsExtensible = Object.isExtensible;
overrideNative(Object, 'isExtensible', function isExtensible(value) {
if (!Type.object(value)) { return false; }
if (!ES.TypeIsObject(value)) { return false; }
return originalObjectIsExtensible(value);
});
}
Expand Down

0 comments on commit c3ca579

Please sign in to comment.