Last active
December 17, 2015 21:39
-
-
Save herschel666/5676355 to your computer and use it in GitHub Desktop.
Multi-Line-String-Wrapper
This file contains hidden or 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
/* | |
* 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