Created
August 11, 2023 04:11
-
-
Save spamshaker/670654f81eff9956ff723889ee9da1fb to your computer and use it in GitHub Desktop.
match-jsdoc-comment.js
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
`/** | |
* This is a comment | |
*/ | |
class MyClass { | |
/** | |
* This is a comment | |
*/ | |
function doSmth(){ | |
const thing = ''; | |
return thing + 'done'; | |
} | |
/** | |
* This is a comment | |
*/ | |
function toString(){ | |
return 'MyClass' | |
} | |
} | |
`.match(/(?:\/\/.*$)|(?:\/\*[\s\S]*?\*\/)/g) | |
// out: [ "/**\n * This is a comment\n */", "/**\n \t * This is a comment\n */", "/**\n \t * This is a comment\n */"] |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment