Commit f7ce0d4a authored by irekg's avatar irekg

Improve logic for finding default values

parent 9e2120ad
...@@ -128,14 +128,8 @@ function jsdocParser(text, parsers, options) { ...@@ -128,14 +128,8 @@ function jsdocParser(text, parsers, options) {
// Additional operations on tag.name // Additional operations on tag.name
if (tag.name) { if (tag.name) {
// Figure out if tag type have default value // Figure out if tag type have default value
const part1 = commentString.split(tag.name)[1] const part = commentString.split(new RegExp(`@.+{.+}.+${tag.name}\s?=\s?`))[1]
const part2 = part1.split(/\s/)[0] if (part) tag.name = tag.name + '=' + part.split(/\s/)[0].replace(']', '')
const sliceIndex = part2.indexOf('=')
if (sliceIndex !== -1)
tag.name = tag.name + '=' + part2
.slice(sliceIndex + 1, part2.length)
.replace(']', '')
.trim()
// Optional tag name // Optional tag name
if (tag.type.type === 'OptionalType') tag.name = `[${tag.name}]` if (tag.type.type === 'OptionalType') tag.name = `[${tag.name}]`
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment