(str: unknown)
| 2 | import { HeaderAttributes } from "../services/models/header"; |
| 3 | |
| 4 | export function parseIfValidJson(str: unknown) { |
| 5 | if (typeof str !== "string") return null; |
| 6 | try { |
| 7 | const parsedObj = JSON.parse(str); |
| 8 | // Return only if it is an object & not a primitive value |
| 9 | if (Object(parsedObj) === parsedObj) return parsedObj; |
| 10 | return null; |
| 11 | } catch (e) { |
| 12 | return null; |
| 13 | } |
| 14 | } |
| 15 | |
| 16 | export enum ScanOptionKeys { |
| 17 | CLASSIFY = "--classify", |
no outgoing calls
no test coverage detected