Clone and edit this document
Runkit
Runkit
home page
user forum
new notebook
clone notebook
download notebook
support & documentation
log in
sign up
new notebook
help & feedback
clone this notebook
download this notebook
Sign In
Sign Up
RunKit + npm: comment-parser
node v17.9.1
version:
master
endpoint
share
tweet
const {parse, tokenizers} = require("comment-parser") const DEFAULT = 'default'; const DEFAULT_Value = 'defaultvalue'; const { name: nameTokenizer, tag: tagTokenizer, type: typeTokenizer, description: descriptionTokenizer } = tokenizers; const commentString = `/** * The value * * @default [] */` const parsed = parse(commentString, { spacing: "preserve", tokenizers: [ tagTokenizer(), typeTokenizer(), (spec) => { if ([DEFAULT, DEFAULT_Value].includes(spec.tag)) { console.log(commentString) console.log(spec) return spec; } return nameTokenizer()(spec); }, descriptionTokenizer('preserve') ], })[0];
Created from: https://npm.runkit.com/comment-parser
Loading…
no comments
sign in
to comment