UNPKG

atlassian-connect-express

Version:

Library for building Atlassian Add-ons on top of Express

25 lines (20 loc) 389 B
function getAsObject(val) { if (typeof val === "string") { try { val = JSON.parse(val); } catch (e) { // it's OK if we can't parse this. We'll just return the string below. } } return val; } function getAsString(val) { if (typeof val === "string") { return val; } return JSON.stringify(val); } module.exports = { getAsObject, getAsString };