add SettingMapper.not() and fix is() invalid

This commit is contained in:
Timi
2025-07-23 00:31:07 +08:00
parent 56f874991d
commit 53f100cb4e

View File

@ -46,7 +46,11 @@ export default class SettingMapper {
public static is(key: SettingKey | string, args?: { [key: string]: any }): boolean { public static is(key: SettingKey | string, args?: { [key: string]: any }): boolean {
const value = this.getValueRef(key, args).value; const value = this.getValueRef(key, args).value;
return !value && value === 'true'; return !!value && value === 'true';
}
public static not(key: SettingKey | string, args?: { [key: string]: any }): boolean {
return !this.is(key, args);
} }
public static getValue(key: SettingKey | string, args?: { [key: string]: any }): string | undefined { public static getValue(key: SettingKey | string, args?: { [key: string]: any }): string | undefined {