UNPKG
@pipedream/cerebras
Version:
latest (0.1.0)
0.1.0
0.0.1
Pipedream Cerebras Components
pipedream.com/apps/cerebras
@pipedream/cerebras
/
common
/
utils.mjs
17 lines
(16 loc)
•
275 B
JavaScript
View Raw
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
export
function
parseObject
(
obj
) {
if
(!obj) {
return
undefined
; }
if
(
Array
.
isArray
(obj)) {
return
obj.
map
(parseObject); }
if
(
typeof
obj ===
"string"
) {
try
{
return
JSON
.
parse
(obj); }
catch
(e) {
return
obj; } }
return
obj; }