Skip to content

Instantly share code, notes, and snippets.

@geekrelief
Forked from PAEz/multilineString.js
Last active August 29, 2015 14:05
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 geekrelief/fddadcbc255b7156f1e6 to your computer and use it in GitHub Desktop.
Save geekrelief/fddadcbc255b7156f1e6 to your computer and use it in GitHub Desktop.
function multilineString(_fn)
{
// takes a function with a multiline comment in it and converts it to a multiline string
//
// example:
// var str = loq.mstring(function(){
// /*
// 123
// abc
// */});
// > console.log(str)
// <- "
// 123
// abc
// "
//
var m = _fn.toString().match(/\/\*([\s\S]*)\*\//m);
return m && m[1];
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment