Skip to content
This repository has been archived by the owner on Nov 4, 2024. It is now read-only.

Commit

Permalink
Simplify instanceOf().
Browse files Browse the repository at this point in the history
  • Loading branch information
jdalton committed Jul 10, 2019
1 parent 756429e commit 99a1beb
Showing 1 changed file with 4 additions and 7 deletions.
11 changes: 4 additions & 7 deletions src/util/instance-of.js
Original file line number Diff line number Diff line change
@@ -1,18 +1,15 @@
import getPrototypeOf from "./get-prototype-of.js"
import isObjectLike from "./is-object-like.js"
import shared from "../shared.js"

function init() {
function instanceOf(value, Ctor) {
const CtorProto = Ctor.prototype

if (isObjectLike(value)) {
let proto = value
let proto = value

while ((proto = getPrototypeOf(proto)) !== null) {
if (proto === CtorProto) {
return true
}
while ((proto = getPrototypeOf(proto)) !== null) {
if (proto === CtorProto) {
return true
}
}

Expand Down

0 comments on commit 99a1beb

Please sign in to comment.