Skip to content

Commit f7ec46d

Browse files
author
Rob Meyer
committed
fix: bind to Number.isNaN & Number.isFinite
1 parent b66fc0e commit f7ec46d

File tree

7 files changed

+22
-22
lines changed

7 files changed

+22
-22
lines changed

jscomp/main/builtin_cmi_datasets.ml

Lines changed: 3 additions & 3 deletions
Large diffs are not rendered by default.

jscomp/others/js_float.ml

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -40,7 +40,7 @@ therefore necessary to test for [_NaN].
4040
4141
@see <https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Number/isNaN> MDN
4242
*)
43-
external isNaN : float -> bool = "isNaN" [@@bs.val]
43+
external isNaN : float -> bool = "isNaN" [@@bs.val] [@@bs.scope "Number"]
4444

4545
(** Tests if the given value is finite
4646
@@ -62,7 +62,7 @@ let _ = Js.Float.isFinite 1234
6262
6363
@see <https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Number/isFinite> MDN
6464
*)
65-
external isFinite : float -> bool = "isFinite" [@@bs.val]
65+
external isFinite : float -> bool = "isFinite" [@@bs.val] [@@bs.scope "Number"]
6666

6767
(** Formats a [float] using exponential (scientific) notation
6868

jscomp/test/float_test.js

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -163,8 +163,8 @@ Mt_global.collect_eq(test_id, suites, "File \"float_test.ml\", line 48, characte
163163
var match$3 = Caml_float.caml_modf_float(Number.NaN);
164164

165165
Mt_global.collect_eq(test_id, suites, "File \"float_test.ml\", line 49, characters 5-12", [
166-
isNaN(match$3[0]),
167-
isNaN(match$3[1])
166+
Number.isNaN(match$3[0]),
167+
Number.isNaN(match$3[1])
168168
], [
169169
true,
170170
true

jscomp/test/js_date_test.js

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -45,7 +45,7 @@ var suites_1 = {
4545
(function (param) {
4646
return {
4747
TAG: /* Ok */4,
48-
_0: isNaN(Date.parse("gibberish"))
48+
_0: Number.isNaN(Date.parse("gibberish"))
4949
};
5050
})
5151
],
@@ -77,7 +77,7 @@ var suites_1 = {
7777
(function (param) {
7878
return {
7979
TAG: /* Ok */4,
80-
_0: isNaN(new Date("gibberish").getTime())
80+
_0: Number.isNaN(new Date("gibberish").getTime())
8181
};
8282
})
8383
],

jscomp/test/js_float_test.js

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -21,7 +21,7 @@ var suites_1 = {
2121
return {
2222
TAG: /* Eq */0,
2323
_0: true,
24-
_1: isNaN(NaN)
24+
_1: Number.isNaN(NaN)
2525
};
2626
})
2727
],
@@ -32,7 +32,7 @@ var suites_1 = {
3232
return {
3333
TAG: /* Eq */0,
3434
_0: false,
35-
_1: isNaN(0)
35+
_1: Number.isNaN(0)
3636
};
3737
})
3838
],
@@ -43,7 +43,7 @@ var suites_1 = {
4343
return {
4444
TAG: /* Eq */0,
4545
_0: false,
46-
_1: isFinite(Pervasives.infinity)
46+
_1: Number.isFinite(Pervasives.infinity)
4747
};
4848
})
4949
],
@@ -54,7 +54,7 @@ var suites_1 = {
5454
return {
5555
TAG: /* Eq */0,
5656
_0: false,
57-
_1: isFinite(Pervasives.neg_infinity)
57+
_1: Number.isFinite(Pervasives.neg_infinity)
5858
};
5959
})
6060
],
@@ -65,7 +65,7 @@ var suites_1 = {
6565
return {
6666
TAG: /* Eq */0,
6767
_0: false,
68-
_1: isFinite(NaN)
68+
_1: Number.isFinite(NaN)
6969
};
7070
})
7171
],
@@ -76,7 +76,7 @@ var suites_1 = {
7676
return {
7777
TAG: /* Eq */0,
7878
_0: true,
79-
_1: isFinite(0)
79+
_1: Number.isFinite(0)
8080
};
8181
})
8282
],
@@ -490,7 +490,7 @@ var suites_1 = {
490490
return {
491491
TAG: /* Eq */0,
492492
_0: true,
493-
_1: isNaN(Number("foo"))
493+
_1: Number.isNaN(Number("foo"))
494494
};
495495
})
496496
],

lib/4.06.1/unstable/js_compiler.ml

Lines changed: 3 additions & 3 deletions
Large diffs are not rendered by default.

lib/4.06.1/whole_compiler.ml

Lines changed: 3 additions & 3 deletions
Large diffs are not rendered by default.

0 commit comments

Comments
 (0)