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:
@@ -7,3 +7,16 @@ export const trace = <T>(x: T) => {
|
||||
console.log(x)
|
||||
return x
|
||||
}
|
||||
|
||||
/**
|
||||
* Logs the annotated current value and returns the same value
|
||||
* @param name The name of the log
|
||||
* @curried_param `x` The value to log
|
||||
* @returns The parameter `x` passed to this
|
||||
*/
|
||||
export const namedTrace =
|
||||
(name: string) =>
|
||||
<T>(x: T) => {
|
||||
console.log(`${name}: `, x)
|
||||
return x
|
||||
}
|
||||
|
||||
9
packages/hoppscotch-app/helpers/functional/json.ts
Normal file
9
packages/hoppscotch-app/helpers/functional/json.ts
Normal 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))
|
||||
Reference in New Issue
Block a user