mirror of
https://github.com/DeNNiiInc/dbgate.git
synced 2026-04-19 10:46:00 +00:00
simplify settings
This commit is contained in:
@@ -1,6 +1,8 @@
|
||||
import _ from 'lodash';
|
||||
import { getCurrentSettings } from '../stores';
|
||||
|
||||
export function getIntSettingsValue(settings, name, defaultValue, min = null, max = null) {
|
||||
export function getIntSettingsValue(name, defaultValue, min = null, max = null) {
|
||||
const settings = getCurrentSettings();
|
||||
const parsed = parseInt(settings[name]);
|
||||
if (_.isNaN(parsed)) {
|
||||
return defaultValue;
|
||||
@@ -12,3 +14,10 @@ export function getIntSettingsValue(settings, name, defaultValue, min = null, ma
|
||||
}
|
||||
return defaultValue;
|
||||
}
|
||||
|
||||
export function getBoolSettingsValue(name, defaultValue) {
|
||||
const settings = getCurrentSettings();
|
||||
const res = settings[name];
|
||||
if (res == null) return defaultValue;
|
||||
return !!res;
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user