Permalink
Browse files

add ==

  • Loading branch information...
ujihisa committed Jan 5, 2013
1 parent c499b1b commit b2d5521fc0c40f840dcf84b4e92e5fecfcda5eac
Showing with 20 additions and 0 deletions.
  1. +20 −0 runtime.clj
View
@@ -111,6 +111,26 @@
(defbuiltin !== [x y]
(not= x y))
(defbuiltin == [x y]
(let [x-type (js-type x)
y-type (js-type y)]
(cond
(= x-type y-type)
(= x y)
(or (#{"number" "boolean"} x-type)
(#{"number" "boolean"} y-type))
(= (js-number x) (js-number y))
(or (= "string" x-type) (= "string" y-type))
(= (js-string x) (js-string y))
(and (= "object" x-type) (= "object" y-type))
(prn 'not-implemented-yet)
:else
(prn 'hmm...?))))
(def ^:dynamic *builtins*
(merge *builtins* {'null 'null 'undefined 'undefined 'NaN 'NaN}))

0 comments on commit b2d5521

Please sign in to comment.