js-on-sx: instanceof accepts function operands (fn instanceof Function/Object)
Some checks failed
Test, Build, and Deploy / test-build-deploy (push) Failing after 44s
Some checks failed
Test, Build, and Deploy / test-build-deploy (push) Failing after 44s
This commit is contained in:
@@ -769,9 +769,20 @@
|
||||
(fn
|
||||
(obj ctor)
|
||||
(cond
|
||||
((not (= (type-of obj) "dict")) false)
|
||||
((not (js-function? ctor))
|
||||
(error "TypeError: Right-hand side of instanceof is not callable"))
|
||||
((js-function? obj)
|
||||
(let
|
||||
((proto (js-get-ctor-proto ctor))
|
||||
(fnproto (get js-function-global "prototype"))
|
||||
(objproto (get Object "prototype")))
|
||||
(cond
|
||||
((= proto fnproto) true)
|
||||
((= proto objproto) true)
|
||||
((and (= (type-of obj) "dict") (contains? (keys obj) "__proto__"))
|
||||
(js-instanceof-walk obj proto))
|
||||
(else false))))
|
||||
((not (= (type-of obj) "dict")) false)
|
||||
(else
|
||||
(let
|
||||
((proto (js-get-ctor-proto ctor)))
|
||||
|
||||
Reference in New Issue
Block a user