mirror of
https://github.com/bitburner-official/bitburner-src.git
synced 2024-12-20 05:05:47 +01:00
format and lint
This commit is contained in:
parent
9774235404
commit
3addda7173
@ -803,7 +803,9 @@ export function Root(props: IProps): React.ReactElement {
|
|||||||
...colorProps,
|
...colorProps,
|
||||||
};
|
};
|
||||||
|
|
||||||
const scriptTabText = `${hostname}:~${fileName.startsWith("/") ? "" : "/"}${fileName} ${dirty(index)}`;
|
const scriptTabText = `${hostname}:~${fileName.startsWith("/") ? "" : "/"}${fileName} ${dirty(
|
||||||
|
index,
|
||||||
|
)}`;
|
||||||
return (
|
return (
|
||||||
<Draggable
|
<Draggable
|
||||||
key={fileName + hostname}
|
key={fileName + hostname}
|
||||||
|
@ -62,7 +62,7 @@ class NumeralFormatter {
|
|||||||
if (n === Infinity) return "∞";
|
if (n === Infinity) return "∞";
|
||||||
for (let i = 0; i < extraFormats.length; i++) {
|
for (let i = 0; i < extraFormats.length; i++) {
|
||||||
if (extraFormats[i] < nAbs && nAbs <= extraFormats[i] * 1000) {
|
if (extraFormats[i] < nAbs && nAbs <= extraFormats[i] * 1000) {
|
||||||
return this.format(n as number / extraFormats[i], "0." + "0".repeat(decimalPlaces)) + extraNotations[i];
|
return this.format((n as number) / extraFormats[i], "0." + "0".repeat(decimalPlaces)) + extraNotations[i];
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
if (nAbs < 1000) {
|
if (nAbs < 1000) {
|
||||||
|
@ -5,8 +5,6 @@ import { RunningScript } from "../../../src/Script/RunningScript";
|
|||||||
import { Script } from "../../../src/Script/Script";
|
import { Script } from "../../../src/Script/Script";
|
||||||
import { WorkerScript } from "../../../src/Netscript/WorkerScript";
|
import { WorkerScript } from "../../../src/Netscript/WorkerScript";
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
describe("Netscript Dynamic RAM Calculation/Generation Tests", function () {
|
describe("Netscript Dynamic RAM Calculation/Generation Tests", function () {
|
||||||
const ScriptBaseCost = RamCostConstants.ScriptBaseRamCost;
|
const ScriptBaseCost = RamCostConstants.ScriptBaseRamCost;
|
||||||
// Creates a mock RunningScript object
|
// Creates a mock RunningScript object
|
||||||
@ -87,8 +85,7 @@ describe("Netscript Dynamic RAM Calculation/Generation Tests", function () {
|
|||||||
let curr = fnDesc.reduce((prev, curr) => {
|
let curr = fnDesc.reduce((prev, curr) => {
|
||||||
try {
|
try {
|
||||||
return prev[curr];
|
return prev[curr];
|
||||||
}
|
} catch {
|
||||||
catch{
|
|
||||||
throw new Error(`Invalid function: [${fnDesc}]`);
|
throw new Error(`Invalid function: [${fnDesc}]`);
|
||||||
}
|
}
|
||||||
}, scope as any);
|
}, scope as any);
|
||||||
@ -149,8 +146,7 @@ describe("Netscript Dynamic RAM Calculation/Generation Tests", function () {
|
|||||||
let curr = fnDesc.reduce((prev, curr) => {
|
let curr = fnDesc.reduce((prev, curr) => {
|
||||||
try {
|
try {
|
||||||
return prev[curr];
|
return prev[curr];
|
||||||
}
|
} catch {
|
||||||
catch{
|
|
||||||
throw new Error(`Invalid function: [${fnDesc}]`);
|
throw new Error(`Invalid function: [${fnDesc}]`);
|
||||||
}
|
}
|
||||||
}, scope as any);
|
}, scope as any);
|
||||||
|
@ -241,6 +241,8 @@ describe("Finding the number furthest away from 0", () => {
|
|||||||
expect(numeralWrapper.largestAbsoluteNumber(789123, -123456, -456789)).toEqual(789123);
|
expect(numeralWrapper.largestAbsoluteNumber(789123, -123456, -456789)).toEqual(789123);
|
||||||
});
|
});
|
||||||
test("Should return 0 for invalid input", () => {
|
test("Should return 0 for invalid input", () => {
|
||||||
expect(numeralWrapper.largestAbsoluteNumber("abc" as unknown as number, undefined, null as unknown as number)).toEqual(0);
|
expect(
|
||||||
|
numeralWrapper.largestAbsoluteNumber("abc" as unknown as number, undefined, null as unknown as number),
|
||||||
|
).toEqual(0);
|
||||||
});
|
});
|
||||||
});
|
});
|
||||||
|
Loading…
Reference in New Issue
Block a user