Skip to content

Commit

Permalink
[Refactor] remove unnecessary comparison
Browse files Browse the repository at this point in the history
  • Loading branch information
ljharb committed Jan 10, 2020
1 parent a1098aa commit 4960290
Showing 1 changed file with 7 additions and 8 deletions.
15 changes: 7 additions & 8 deletions es5-sham.js
Original file line number Diff line number Diff line change
Expand Up @@ -301,15 +301,14 @@

if (prototype === null) {
object = createEmpty();
} else if (isPrimitive(prototype)) {
// In the native implementation `parent` can be `null`
// OR *any* `instanceof Object` (Object|Function|Array|RegExp|etc)
// Use `typeof` tho, b/c in old IE, DOM elements are not `instanceof Object`
// like they are in modern browsers. Using `Object.create` on DOM elements
// is...err...probably inappropriate, but the native version allows for it.
throw new TypeError('Object prototype may only be an Object or null'); // same msg as Chrome
} else {
if (prototype !== null && isPrimitive(prototype)) {
// In the native implementation `parent` can be `null`
// OR *any* `instanceof Object` (Object|Function|Array|RegExp|etc)
// Use `typeof` tho, b/c in old IE, DOM elements are not `instanceof Object`
// like they are in modern browsers. Using `Object.create` on DOM elements
// is...err...probably inappropriate, but the native version allows for it.
throw new TypeError('Object prototype may only be an Object or null'); // same msg as Chrome
}
Type.prototype = prototype;
object = new Type();
// IE has no built-in implementation of `Object.getPrototypeOf`
Expand Down

0 comments on commit 4960290

Please sign in to comment.