Skip to content

Instantly share code, notes, and snippets.

@herschel666
Last active December 17, 2015 21:39
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save herschel666/5676355 to your computer and use it in GitHub Desktop.
Save herschel666/5676355 to your computer and use it in GitHub Desktop.
Multi-Line-String-Wrapper
/*
* Wrapper for the Multi-Line-String-approach demonstrated here:
* http://tomasz.janczuk.org/2013/05/multi-line-strings-in-javascript-and.html
*
* multiline(function () {/*
* <body>
* <h1>Hodor!</h1>
* <p>Lorem ipsum dolor sit amet.</p>
* </body>
* */ /* <- needed to keep this as a comment!});
**/
function multiline(fn) {
return (fn).toString().match(/[^]*\/\*([^]*)\*\/\}/)[1];
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment