Skip to content

Commit 2966b7e

Browse files
committed
1 parent f6b2ae2 commit 2966b7e

File tree

1 file changed

+12
-18
lines changed

1 file changed

+12
-18
lines changed

std/js/lib/BigInt.hx

Lines changed: 12 additions & 18 deletions
Original file line numberDiff line numberDiff line change
@@ -23,6 +23,7 @@
2323
package js.lib;
2424

2525
import js.Syntax;
26+
import js.Lib.undefined;
2627
import haxe.extern.EitherType;
2728
import js.lib.intl.NumberFormat.NumberFormatOptions;
2829

@@ -46,31 +47,24 @@ abstract BigInt {
4647
Overrides the `Object.prototype.toLocaleString()` method.
4748
**/
4849
public inline function toLocaleString(?locales:EitherType<String, Array<String>>, ?options:NumberFormatOptions):String {
49-
return if (locales == null) {
50-
if (options == null) {
51-
Syntax.code("({0}).toLocaleString()", this);
52-
} else {
53-
Syntax.code("({0}).toLocaleString({1}, {2})", this, js.Lib.undefined, options);
54-
}
55-
} else {
56-
if (options == null) {
57-
Syntax.code("({0}).toLocaleString({1})", this, locales);
58-
} else {
59-
Syntax.code("({0}).toLocaleString({1}, {2})", this, locales, options);
60-
}
61-
}
50+
return Syntax.code(
51+
"({0}).toLocaleString({1}, {2})",
52+
this,
53+
(locales != null) ? locales : undefined,
54+
(options != null) ? options : undefined
55+
);
6256
}
6357

6458
/**
6559
Returns a string representing the specified object in the specified radix (base).
6660
Overrides the `Object.prototype.toString()` method.
6761
**/
6862
public inline function toString(?radix:Int):String {
69-
return if (radix == null) {
70-
return Syntax.code("({0}).toString()", this);
71-
} else {
72-
return Syntax.code("({0}).toString({1})", this, radix);
73-
}
63+
return Syntax.code(
64+
"({0}).toString({1})",
65+
this,
66+
(radix != null) ? radix : undefined
67+
);
7468
}
7569

7670
/**

0 commit comments

Comments
 (0)