UNPKG

@pipedream/omnisend

Version:

Pipedream Omnisend Components

19 lines (18 loc) 360 B
export const parseObject = (obj) => { if (Array.isArray(obj)) { return obj.map((item) => { if (typeof item === "string") { try { return JSON.parse(item); } catch (e) { return item; } } return item; }); } if (typeof obj === "string") { return JSON.parse(obj); } return obj; };