23
23
package js .lib ;
24
24
25
25
import js .Syntax ;
26
+ import js .Lib .undefined ;
26
27
import haxe .extern .EitherType ;
27
28
import js .lib .intl .NumberFormat .NumberFormatOptions ;
28
29
@@ -46,31 +47,24 @@ abstract BigInt {
46
47
Overrides the `Object.prototype.toLocaleString()` method.
47
48
**/
48
49
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
+ );
62
56
}
63
57
64
58
/**
65
59
Returns a string representing the specified object in the specified radix (base).
66
60
Overrides the `Object.prototype.toString()` method.
67
61
**/
68
62
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
+ );
74
68
}
75
69
76
70
/**
0 commit comments