Created
May 26, 2015 20:38
-
-
Save madbook/7980a0d70705e7858733 to your computer and use it in GitHub Desktop.
js multiline string function hack
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
function _multiline(fnc) { | |
return fnc.toString().replace(/^function *\(\) *\{ *\/\* */, '').replace(/ *\*\/ *\} *$/, ''); | |
} | |
// example | |
var template = _multiline(function(){/* | |
<div id="some_id"> | |
<h1>Multiline strings without all the bullshit</h1> | |
<p>This is a pretty terrible hack, probably don't actually do this ever.</p> | |
</div> | |
*/}); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment