mirror of
https://github.com/bitburner-official/bitburner-src.git
synced 2026-05-02 05:47:14 +02:00
Commit1
This commit is contained in:
@@ -1,5 +1,4 @@
|
||||
import { Settings } from "../Settings/Settings";
|
||||
import { EqualityFunc } from "../types";
|
||||
import { isString } from "./helpers/isString";
|
||||
|
||||
/*
|
||||
@@ -65,7 +64,7 @@ function longestCommonStart(strings: string[]): string {
|
||||
const a2: string = A[A.length - 1];
|
||||
const L: number = a1.length;
|
||||
let i = 0;
|
||||
const areEqualCaseInsensitive: EqualityFunc<string> = (a: string, b: string) => a.toUpperCase() === b.toUpperCase();
|
||||
const areEqualCaseInsensitive = (a: string, b: string) => a.toUpperCase() === b.toUpperCase();
|
||||
while (i < L && areEqualCaseInsensitive(a1.charAt(i), a2.charAt(i))) {
|
||||
i++;
|
||||
}
|
||||
|
||||
@@ -1,6 +0,0 @@
|
||||
export function checkEnum<T extends string, TEnumValue extends string>(
|
||||
enumVariable: { [key in T]: TEnumValue },
|
||||
value: string,
|
||||
): value is TEnumValue {
|
||||
return Object.values(enumVariable).includes(value);
|
||||
}
|
||||
@@ -0,0 +1,7 @@
|
||||
// This works for both enums and regular objects.
|
||||
export function checkObjContainsValue<T extends Record<string, string>>(
|
||||
obj: T,
|
||||
value: string,
|
||||
): value is T[keyof T] {
|
||||
return Object.values(obj).includes(value);
|
||||
}
|
||||
Reference in New Issue
Block a user