fix: parsing of protocol correctly (#2088)

Co-authored-by: Liyas Thomas <hi@liyasthomas.com>
Co-authored-by: Andrew Bastin <andrewbastin.k@gmail.com>
Co-authored-by: liyasthomas <liyascthomas@gmail.com>
Co-authored-by: Rishabh Agarwal <45998880+RishabhAgarwal-2001@users.noreply.github.com>
This commit is contained in:
kyteinsky
2022-02-22 17:33:22 +00:00
committed by GitHub
parent 16e790e87e
commit 0c96993cc0
7 changed files with 994 additions and 329 deletions

View File

@@ -0,0 +1,9 @@
import * as O from "fp-ts/Option"
/**
* Checks and Parses JSON string
* @param str Raw JSON data to be parsed
* @returns Option type with some(JSON data) or none
*/
export const safeParseJSON = (str: string): O.Option<object> =>
O.tryCatch(() => JSON.parse(str))