mirror of
https://github.com/bitburner-official/bitburner-src.git
synced 2026-04-27 11:27:04 +02:00
Commit1
This commit is contained in:
@@ -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