47 lines
1.1 KiB
JavaScript
47 lines
1.1 KiB
JavaScript
// Metro module 1316 (f1317).
|
|
export function assert(a0, a1) {
|
|
if (a0) {
|
|
return void 0;
|
|
}
|
|
throw new Error(a1);
|
|
}
|
|
export function assertNever(a0, a1) {
|
|
let r3 = a1;
|
|
const r7 = Error;
|
|
if (a1 == null) {
|
|
r3 = "Unexpected object: " + a0;
|
|
}
|
|
throw new r7(r3);
|
|
}
|
|
export function assertInt32(a0) {
|
|
if (typeof a0 !== "number") {
|
|
throw new Error("invalid int 32: " + typeof a0);
|
|
}
|
|
if (Number.isInteger(a0) && !(a0 > 2147483647) && !(a0 < -2147483648)) {
|
|
return void 0;
|
|
}
|
|
throw new Error("invalid int 32: " + a0);
|
|
}
|
|
export function assertUInt32(a0) {
|
|
if (typeof a0 !== "number") {
|
|
throw new Error("invalid uint 32: " + typeof a0);
|
|
}
|
|
if (Number.isInteger(a0) && !(a0 > 4294967295) && !(a0 < 0)) {
|
|
return void 0;
|
|
}
|
|
throw new Error("invalid uint 32: " + a0);
|
|
}
|
|
export function assertFloat32(a0) {
|
|
if (typeof a0 !== "number") {
|
|
throw new Error("invalid float 32: " + typeof a0);
|
|
}
|
|
L4: {
|
|
if (Number.isFinite(a0)) {
|
|
if (!(a0 > 3.4028234663852886e38) && !(a0 < -3.4028234663852886e38)) {
|
|
break L4;
|
|
}
|
|
throw new Error("invalid float 32: " + a0);
|
|
}
|
|
}
|
|
}
|