forked from baron/baron-sso
devfront RP 설정 표 공통화 및 레이아웃 정리
This commit is contained in:
@@ -29,6 +29,23 @@ function mergeTomlObjects(base: TomlObject, override: TomlObject): TomlObject {
|
||||
return result;
|
||||
}
|
||||
|
||||
function setTomlValue(
|
||||
target: TomlObject,
|
||||
path: string[],
|
||||
value: TomlValue,
|
||||
): void {
|
||||
let cursor: TomlObject = target;
|
||||
for (let index = 0; index < path.length - 1; index += 1) {
|
||||
const key = path[index];
|
||||
const current = cursor[key];
|
||||
if (!current || typeof current === "string") {
|
||||
cursor[key] = {};
|
||||
}
|
||||
cursor = cursor[key] as TomlObject;
|
||||
}
|
||||
cursor[path[path.length - 1]] = value;
|
||||
}
|
||||
|
||||
function isSupportedLocale(value: string): value is Locale {
|
||||
return (SUPPORTED_LOCALES as readonly string[]).includes(value);
|
||||
}
|
||||
@@ -82,7 +99,7 @@ function parseToml(raw: string): TomlObject {
|
||||
cursor = cursor[section] as TomlObject;
|
||||
}
|
||||
|
||||
cursor[key] = value;
|
||||
setTomlValue(cursor, key.split("."), value);
|
||||
}
|
||||
|
||||
return root;
|
||||
|
||||
Reference in New Issue
Block a user