Skip to content

Commit

Permalink
Fix some inline issue in doc (#25)
Browse files Browse the repository at this point in the history
  • Loading branch information
dej611 authored Mar 31, 2021
1 parent 5314873 commit b249f4b
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 4 deletions.
2 changes: 1 addition & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -51,7 +51,7 @@ The SPIDButtonProps object contains the following properties:

#### configuration

**Possible values**: `{ method : "GET" } | { extraFields ?: Record<string | string>fieldName : stringmethod : "POST" }`
**Possible values**: `{ method : "GET" } | { extraFields ?: Record<string | string>, fieldName : string, method : "POST" }`

**Type**: `ConfigurationGET | ConfigurationPOST`

Expand Down
9 changes: 6 additions & 3 deletions scripts/doc.js
Original file line number Diff line number Diff line change
Expand Up @@ -52,7 +52,7 @@ function getChildren({ kindString, children, type }) {
throw Error('No children found');
}

function typeDescription({ type, ...props }) {
function typeDescription({ type, ...props }, inline = false) {
if (type === 'literal') {
return '"' + props.value + '"';
}
Expand Down Expand Up @@ -87,7 +87,9 @@ function typeDescription({ type, ...props }) {
if (props.declaration.children) {
// object shaped
return `{
${props.declaration.children.map(typeDescription).join('\n')}
${props.declaration.children
.map(typeDescription)
.join(inline ? ', ' : '\n')}
}`;
}
if (props.declaration.signatures) {
Expand All @@ -109,7 +111,8 @@ function unrollType(record, array) {
const referenced = array.find(({ name }) => name === record.name);
if (referenced) {
const value = typeDescription(
referenced.type ? referenced.type : referenced
referenced.type ? referenced.type : referenced,
true
);
return value && value.replace(/\n/g, '');
}
Expand Down

0 comments on commit b249f4b

Please sign in to comment.