File tree Expand file tree Collapse file tree 3 files changed +13
-8
lines changed Expand file tree Collapse file tree 3 files changed +13
-8
lines changed Original file line number Diff line number Diff line change 251
251
(instance? js/Array x)))
252
252
253
253
(defn ^boolean number?
254
- " Returns true if x is a JavaScript number. "
254
+ " Returns true if x is a JavaScript Number or BigInt "
255
255
[x]
256
- (cljs.core/number? x))
256
+ (or (cljs.core/js-number? x)
257
+ (cljs.core/bigint? x)))
257
258
258
259
(defn not
259
260
" Returns true if x is logical false, false otherwise."
@@ -2313,7 +2314,7 @@ reduces them without incurring seq initialization"
2313
2314
" Returns true if n is a JavaScript number with no decimal part."
2314
2315
[n]
2315
2316
(and (number? n)
2316
- (not ^boolean (js/isNaN n))
2317
+ (not ^boolean (js/Number. isNaN n))
2317
2318
(not (identical? n js/Infinity))
2318
2319
(== (js/parseFloat n) (js/parseInt n 10 ))))
2319
2320
@@ -10509,10 +10510,10 @@ reduces them without incurring seq initialization"
10509
10510
(number? obj)
10510
10511
(-write writer
10511
10512
(cond
10512
- ^boolean (js/isNaN obj) " ##NaN"
10513
+ ^boolean (js/Number. isNaN obj) " ##NaN"
10513
10514
(identical? obj js/Number.POSITIVE_INFINITY) " ##Inf"
10514
10515
(identical? obj js/Number.NEGATIVE_INFINITY) " ##-Inf"
10515
- :else (str obj)))
10516
+ :else (str obj ( when ( bigint? obj) " N " ) )))
10516
10517
10517
10518
(object? obj)
10518
10519
(do
@@ -12211,7 +12212,7 @@ reduces them without incurring seq initialization"
12211
12212
(defn ^boolean NaN?
12212
12213
" Returns true if num is NaN, else false"
12213
12214
[val]
12214
- (js/isNaN val))
12215
+ (js/Number. isNaN val))
12215
12216
12216
12217
(defn ^:private parsing-err
12217
12218
" Construct message for parsing for non-string parsing error"
Original file line number Diff line number Diff line change 345
345
(defmethod emit-constant* BigDecimal [x] (emits (.doubleValue ^BigDecimal x))))
346
346
347
347
#?(:clj
348
- (defmethod emit-constant* clojure.lang.BigInt [x] (emits (.doubleValue ^clojure.lang.BigInt x))))
348
+ (defmethod emit-constant* clojure.lang.BigInt [x]
349
+ (emits " (" (.toString ^clojure.lang.BigInt x) " n)" )))
349
350
350
351
(defmethod emit-constant* #? (:clj String :cljs js/String) [x]
351
352
(emits (wrap-in-double-quotes (escape-string x))))
Original file line number Diff line number Diff line change 1007
1007
`(let [c# ~c x# ~x]
1008
1008
(~'js* " (~{} instanceof ~{})" x# c#)))))
1009
1009
1010
- (core/defmacro number? [x]
1010
+ (core/defmacro js- number? [x]
1011
1011
(bool-expr (core/list 'js* " typeof ~{} === 'number'" x)))
1012
1012
1013
+ (core/defmacro bigint? [x]
1014
+ (bool-expr (core/list 'js* " typeof ~{} === 'bigint'" x)))
1015
+
1013
1016
(core/defmacro symbol? [x]
1014
1017
(bool-expr `(instance? Symbol ~x)))
1015
1018
You can’t perform that action at this time.
0 commit comments