hyprpanel

This commit is contained in:
wt committed 2024-10-23 21:12:15 +07:00
1 parent 10080a83ee
commit 5151ac24da
322 files changed
+38276

No files matched your search

+29
View File
@@ -0,0 +1,29 @@
import { Opt } from 'lib/option';
import { HexColor, MatugenTheme, RecursiveOptionsObject } from 'lib/types/options';
export const isOpt = <T>(value: unknown): value is Opt<T> =>
typeof value === 'object' && value !== null && 'value' in value && value instanceof Opt;
export const isOptString = (value: unknown): value is Opt<string> => {
return value instanceof Opt && typeof value.value === 'string';
};
export const isOptNumber = (value: unknown): value is Opt<number> => {
return value instanceof Opt && typeof value.value === 'number';
};
export const isOptBoolean = (value: unknown): value is Opt<boolean> => {
return value instanceof Opt && typeof value.value === 'boolean';
};
export const isOptMatugenTheme = (value: unknown): value is Opt<MatugenTheme> => {
return value instanceof Opt && typeof value.value === 'object' && 'specificProperty' in value.value; // Replace 'specificProperty' with an actual property of MatugenTheme
};
export const isRecursiveOptionsObject = (value: unknown): value is RecursiveOptionsObject => {
return typeof value === 'object' && value !== null && !(value instanceof Opt);
};
export const isHexColor = (val: unknown): val is HexColor => {
return typeof val === 'string' && /^#([A-Fa-f0-9]{6}|[A-Fa-f0-9]{3})$/.test(val);
};