mirror of
https://github.com/sasjs/adapter.git
synced 2026-01-14 23:50:06 +00:00
chore: type fix
This commit is contained in:
@@ -2,7 +2,7 @@
|
|||||||
* Checks if string is in valid JSON format else throw error.
|
* Checks if string is in valid JSON format else throw error.
|
||||||
* @param str - string to check.
|
* @param str - string to check.
|
||||||
*/
|
*/
|
||||||
export const isValidJson = (str: string) => {
|
export const isValidJson = (str: string | object) => {
|
||||||
try {
|
try {
|
||||||
str = typeof str !== 'string' ? JSON.stringify(str) : str
|
str = typeof str !== 'string' ? JSON.stringify(str) : str
|
||||||
JSON.parse(str)
|
JSON.parse(str)
|
||||||
|
|||||||
Reference in New Issue
Block a user