Created
August 23, 2021 11:34
-
-
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
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
exports.object2Html = (obj) => JSON.stringify(obj, null, 2) | |
.replace(/\n\s\s\s\s\s\s/g, "<br />      ") | |
.replace(/\n\s\s\s\s\s/g, "<br />     ") | |
.replace(/\n\s\s\s\s/g, "<br />    ") | |
.replace(/\n\s\s\s/g, "<br />   ") | |
.replace(/\n\s\s/g, "<br />  ") | |
.replace(/\n\s/g, "<br /> ") | |
.replace(/\n/, "<br />"); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment