Created
December 1, 2013 08:07
-
-
Save yatemmma/7729759 to your computer and use it in GitHub Desktop.
javascriptでヒアドキュメント風
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.prototype.heredoc = function() { | |
return this.toString().match(/[^]*\/\*([^]*)\*\/\}$/)[1].replace(/^\n/, ""); | |
}; | |
var doc = (function() {/* | |
hoge hoge | |
fuga fuga | |
piyo piyo | |
*/}).heredoc(); | |
alert(doc); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment