Skip to content

Instantly share code, notes, and snippets.

@inceabdullah
Created August 23, 2021 11:34
Show Gist options
  • Save inceabdullah/5242c20f18d67e99c8579b8f31fcc660 to your computer and use it in GitHub Desktop.
Save inceabdullah/5242c20f18d67e99c8579b8f31fcc660 to your computer and use it in GitHub Desktop.
in email body, to read any json-like object as html formatted to be seen easy
exports.object2Html = (obj) => JSON.stringify(obj, null, 2)
.replace(/\n\s\s\s\s\s\s/g, "<br />&emsp;&emsp;&emsp;&emsp;&emsp;&emsp;")
.replace(/\n\s\s\s\s\s/g, "<br />&emsp;&emsp;&emsp;&emsp;&emsp;")
.replace(/\n\s\s\s\s/g, "<br />&emsp;&emsp;&emsp;&emsp;")
.replace(/\n\s\s\s/g, "<br />&emsp;&emsp;&emsp;")
.replace(/\n\s\s/g, "<br />&emsp;&emsp;")
.replace(/\n\s/g, "<br />&emsp;")
.replace(/\n/, "<br />");
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment