mirror of
https://github.com/quinton-ashley/java2js
synced 2024-12-29 10:11:54 +01:00
1.2.19
This commit is contained in:
parent
848226ee2f
commit
c2a07d4cdd
@ -10,6 +10,13 @@ jdk.imports['java.lang.Double'].load = async () => {
|
||||
Double.compare = (a, b) => {
|
||||
return a - b;
|
||||
};
|
||||
Double.valueOf = (a) => {
|
||||
let val = Number(a);
|
||||
if (isNaN(val)) {
|
||||
throw new Error('NumberFormatException: For input string: ' + a);
|
||||
}
|
||||
return val;
|
||||
};
|
||||
Double.MAX_VALUE = Number.MAX_VALUE;
|
||||
Double.POSITIVE_INFINITY = Number.POSITIVE_INFINITY;
|
||||
Double.NEGATIVE_INFINITY = Number.NEGATIVE_INFINITY;
|
||||
|
@ -6,6 +6,13 @@ jdk.imports['java.lang.Float'].load = async () => {
|
||||
Float.compare = (a, b) => {
|
||||
return a - b;
|
||||
};
|
||||
Float.valueOf = (a) => {
|
||||
let val = Number(a);
|
||||
if (isNaN(val)) {
|
||||
throw new Error('NumberFormatException: For input string: ' + a);
|
||||
}
|
||||
return val;
|
||||
};
|
||||
Float.MAX_VALUE = Number.MAX_VALUE;
|
||||
Float.POSITIVE_INFINITY = Number.POSITIVE_INFINITY;
|
||||
Float.NEGATIVE_INFINITY = Number.NEGATIVE_INFINITY;
|
||||
|
@ -6,6 +6,13 @@ jdk.imports['java.lang.Integer'].load = async () => {
|
||||
Integer.compare = (a, b) => {
|
||||
return a - b;
|
||||
};
|
||||
Integer.valueOf = (a) => {
|
||||
let val = Number(a);
|
||||
if (isNaN(val)) {
|
||||
throw new Error('NumberFormatException: For input string: ' + a);
|
||||
}
|
||||
return val;
|
||||
};
|
||||
Integer.MAX_VALUE = Number.MAX_VALUE;
|
||||
Integer.POSITIVE_INFINITY = Number.POSITIVE_INFINITY;
|
||||
Integer.NEGATIVE_INFINITY = Number.NEGATIVE_INFINITY;
|
||||
|
@ -6,6 +6,13 @@ jdk.imports['java.lang.Long'].load = async () => {
|
||||
Long.compare = (a, b) => {
|
||||
return a - b;
|
||||
};
|
||||
Long.valueOf = (a) => {
|
||||
let val = Number(a);
|
||||
if (isNaN(val)) {
|
||||
throw new Error('NumberFormatException: For input string: ' + a);
|
||||
}
|
||||
return val;
|
||||
};
|
||||
Long.MAX_VALUE = Number.MAX_VALUE;
|
||||
Long.POSITIVE_INFINITY = Number.POSITIVE_INFINITY;
|
||||
Long.NEGATIVE_INFINITY = Number.NEGATIVE_INFINITY;
|
||||
|
@ -6,6 +6,13 @@ jdk.imports['java.lang.Short'].load = async () => {
|
||||
Short.compare = (a, b) => {
|
||||
return a - b;
|
||||
};
|
||||
Short.valueOf = (a) => {
|
||||
let val = Number(a);
|
||||
if (isNaN(val)) {
|
||||
throw new Error('NumberFormatException: For input string: ' + a);
|
||||
}
|
||||
return val;
|
||||
};
|
||||
Short.MAX_VALUE = Number.MAX_VALUE;
|
||||
Short.POSITIVE_INFINITY = Number.POSITIVE_INFINITY;
|
||||
Short.NEGATIVE_INFINITY = Number.NEGATIVE_INFINITY;
|
||||
|
@ -34,4 +34,12 @@ jdk.imports['java.lang.String'].load = async () => {
|
||||
return new Formatter().format(format, ...args);
|
||||
};
|
||||
jdk.java.lang.String = String;
|
||||
|
||||
Number.prototype.toUpperCase = function () {
|
||||
return this + '';
|
||||
};
|
||||
|
||||
Number.prototype.toLowerCase = function () {
|
||||
return this + '';
|
||||
};
|
||||
};
|
||||
|
@ -1,6 +1,6 @@
|
||||
{
|
||||
"name": "java2js",
|
||||
"version": "1.2.18",
|
||||
"version": "1.2.19",
|
||||
"description": "Converts Java to JavaScript and runs it with a JS JDK",
|
||||
"main": "jdk.js",
|
||||
"scripts": {
|
||||
|
Loading…
x
Reference in New Issue
Block a user