mirror of
https://github.com/slint-ui/slint.git
synced 2025-10-28 10:49:46 +00:00
21 lines
584 B
TypeScript
21 lines
584 B
TypeScript
// Copyright © onWidget <https://github.com/onwidget>
|
|
// SPDX-License-Identifier: MIT
|
|
import fs from "node:fs";
|
|
import yaml from "js-yaml";
|
|
|
|
const loadConfig = async (configPathOrData: string | object) => {
|
|
if (typeof configPathOrData === "string") {
|
|
const content = fs.readFileSync(configPathOrData, "utf8");
|
|
if (
|
|
configPathOrData.endsWith(".yaml") ||
|
|
configPathOrData.endsWith(".yml")
|
|
) {
|
|
return yaml.load(content);
|
|
}
|
|
return content;
|
|
}
|
|
|
|
return configPathOrData;
|
|
};
|
|
|
|
export default loadConfig;
|