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

Function parseJSON

test/README.example.proof.ts:581–589  ·  view source on GitHub ↗
(json: string)

Source from the content-addressed store, hash-verified

579 const raise: EffectFactory<Raise> = effect("raise", { resumable: false });
580
581 const parseJSON = <T>(json: string): Effected<SyntaxError | Raise, T> =>
582 effected(function* () {
583 try {
584 return JSON.parse(json);
585 } catch (e) {
586 if (e instanceof SyntaxError) return yield* syntaxError(e.message);
587 return yield* raise(e);
588 }
589 });
590
591 interface Settings {
592 something: string;

Callers 1

readSettingsFunction · 0.70

Calls 1

effectedFunction · 0.90

Tested by

no test coverage detected