2016년 7월 31일 일요일

[snippet] js heredoc

function hereDoc(f) {
  return f.toString().
      replace(/^[^\/]+\/\*!?/, '').
      replace(/\*\/[^\/]+$/, '');
}
var tennysonQuote = hereDoc(function() {/*!
  Theirs not to make reply,
  Theirs not to reason why,
  Theirs but to do and die
*/});
http://stackoverflow.com/questions/805107/creating-multiline-strings-in-javascript

댓글 없음:

댓글 쓰기