BililiveRecorder/config_gen/utils.ts

16 lines
436 B
TypeScript
Raw Permalink Normal View History

2022-06-10 16:34:25 +08:00
import { ConfigEntry } from "./types";
2021-08-13 21:03:21 +08:00
export function trimEnd(text: string, trimChar: string): string {
return text.slice(-1) === trimChar
? text.slice(0, -1)
: text;
2022-06-10 16:34:25 +08:00
}
export function getConfigDefaultValueText(config: ConfigEntry): string {
if (config.type != "string?") {
return config.default.toString();
} else {
return `@"${config.default.toString().replaceAll('"', '""')}"`;
}
}