MCPcopy Create free account
hub / github.com/Snowflyt/tinyeffect / readSettings

Function readSettings

test/README.example.spec.ts:777–788  ·  view source on GitHub ↗
(path: string)

Source from the content-addressed store, hash-verified

775 };
776
777 const readSettings = (path: string): Effected<Logging | ReadFile, Settings> =>
778 effected(function* () {
779 const content = yield* readFile(path);
780 try {
781 const settings = JSON.parse(content);
782 yield* logger.log("Settings loaded");
783 return settings;
784 } catch (e) {
785 yield* logger.error("Failed to parse settings file:", e);
786 return defaultSettings;
787 }
788 });
789
790 const readSettingsWithoutLogging = readSettings("settings.json").resume(
791 (name): name is Logging["name"] => name.startsWith("logging:"),

Callers 1

Calls 3

effectedFunction · 0.90
parseJSONFunction · 0.70
catchMethod · 0.65

Tested by

no test coverage detected