Merge branch 'orphan-pr/2243' into 2087-openapi
This commit is contained in:
@@ -17,6 +17,6 @@ export const trace = <T>(x: T) => {
|
||||
export const namedTrace =
|
||||
(name: string) =>
|
||||
<T>(x: T) => {
|
||||
console.log(`${name}: `, x)
|
||||
console.log(`${name}:`, x)
|
||||
return x
|
||||
}
|
||||
|
||||
@@ -1,4 +1,5 @@
|
||||
import * as O from "fp-ts/Option"
|
||||
import { flow } from "fp-ts/function"
|
||||
|
||||
/**
|
||||
* Checks and Parses JSON string
|
||||
@@ -15,3 +16,10 @@ export const safeParseJSON = (str: string): O.Option<object> =>
|
||||
*/
|
||||
export const prettyPrintJSON = (obj: unknown): O.Option<string> =>
|
||||
O.tryCatch(() => JSON.stringify(obj, null, "\t"))
|
||||
|
||||
/**
|
||||
* Checks if given string is a JSON string
|
||||
* @param str Raw string to be checked
|
||||
* @returns If string is a JSON string
|
||||
*/
|
||||
export const isJSON = flow(safeParseJSON, O.isSome)
|
||||
|
||||
Reference in New Issue
Block a user