4 ms·
This snippet does the same thing, mostly: var multiline = function(){/* foo bar baz */}.toSource().match(/\/\*([\s\S]*)\*\//)[1].trim()
by andrelaszlo 12y ago
This snippet does the same thing, mostly:
var multiline = function(){/*
foo
bar
baz
*/}.toSource().match(/\/\*([\s\S]*)\*\//)[1].trim()
- mofle 12y agoYeah, pretty much, but in Node we wrap repetitive things in modules, as they're super cheap. Your snippet is also missing some things like indentation stripping, error handling and browser support.