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

Function parseJSON

test/README.example.spec.ts:951–959  ·  view source on GitHub ↗
(json: string)

Source from the content-addressed store, hash-verified

949 const raise: EffectFactory<Raise> = effect("raise", { resumable: false });
950
951 const parseJSON = <T>(json: string): Effected<SyntaxError | Raise, T> =>
952 effected(function* () {
953 try {
954 return JSON.parse(json);
955 } catch (e) {
956 if (e instanceof SyntaxError) return yield* syntaxError(e.message);
957 return yield* raise(e);
958 }
959 });
960
961 interface Settings {
962 something: string;

Callers 1

readSettingsFunction · 0.70

Calls 1

effectedFunction · 0.90

Tested by

no test coverage detected