Comparing version 1.1.0 to 1.2.0
@@ -7,2 +7,7 @@ const { getPropType, getNameWithDefault } = require('.'); | ||
class Property { | ||
static fromXML(...args) { | ||
const prop = new Property() | ||
prop.fromXML(...args) | ||
return prop | ||
} | ||
fromXML(content, | ||
@@ -9,0 +14,0 @@ { name, string, boolean, opt, number, type, default: def }, |
@@ -24,2 +24,4 @@ let extractTags = require('rexml'); if (extractTags && extractTags.__esModule) extractTags = extractTags.default; | ||
/** @type {Property[]} */ | ||
this.properties = [] | ||
if (content) { | ||
@@ -59,2 +61,3 @@ const ps = extractTags('prop', content) | ||
} | ||
/** @param {Type[]} allTypes */ | ||
toMarkdown(allTypes = []) { | ||
@@ -117,4 +120,5 @@ const t = this.type ? `\`${this.type}\`` : '' | ||
*/ | ||
const makePropsTable = (props = [], allTypes = []) => { | ||
const makePropsTable = (props = [], allTypes = []) => { | ||
if (!props.length) return '' | ||
const anyHaveDefault = props.some(({ hasDefault }) => hasDefault) | ||
@@ -128,3 +132,6 @@ const h = ['Name', 'Type', 'Description', 'Default'] | ||
}) | ||
const res = [h, ...ps] | ||
const pre = [h, ...ps] | ||
const res = anyHaveDefault | ||
? pre | ||
: pre.map(([name, type, desc]) => [name, type, desc]) | ||
const j = JSON.stringify(res) | ||
@@ -153,2 +160,3 @@ return ` | ||
module.exports.getLinks = getLinks | ||
module.exports.makePropsTable = makePropsTable | ||
//# sourceMappingURL=Type.js.map |
## 25 September 2018 | ||
### 1.2.0 | ||
- [feature] Skip printing `Default` column when no properties have it. | ||
### 1.1.0 | ||
@@ -4,0 +8,0 @@ |
{ | ||
"name": "typal", | ||
"version": "1.1.0", | ||
"version": "1.2.0", | ||
"description": "Keeps JSDoc types in XML files and converts them to JavaScript and Markdown.", | ||
@@ -39,3 +39,3 @@ "main": "build", | ||
"alamode": "1.5.1", | ||
"documentary": "1.19.0", | ||
"documentary": "1.20.0", | ||
"eslint-config-artdeco": "1.0.1", | ||
@@ -42,0 +42,0 @@ "yarn-s": "1.1.0", |
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
33051
244