4 ms·
not in the language itself, but you can obtain the full text of a function, detect the comment and parse it, and inject it where ever it needs to go.
by marpstar 11y ago
not in the language itself, but you can obtain the full text of a function, detect the comment and parse it, and inject it where ever it needs to go.
- STRML 11y agoYep. "Passing a comment" is used by calling .toString() on the function. It fails when using minification for obvious reasons but of course you wouldn't on Node code. It's a clever hack around JS's awful multiline string support. But with ES6 template strings it's not really needed anymore.