Skip to content

Commit

Permalink
Letter.toString(): Only include string parts of information block (#16)
Browse files Browse the repository at this point in the history
This avoids having "[object Object]" in the output for non-string
parts of the information block.
  • Loading branch information
baltpeter authored Oct 26, 2022
1 parent 089f878 commit 9d8e5bc
Showing 1 changed file with 1 addition and 1 deletion.
2 changes: 1 addition & 1 deletion src/Letter.ts
Original file line number Diff line number Diff line change
Expand Up @@ -65,7 +65,7 @@ export class Letter {
/** Render the letter as a string, used e.g. for emails. */
toString() {
const information_block = Array.isArray(this.props.information_block)
? this.props.information_block.join('\n')
? this.props.information_block.filter((e) => typeof e === 'string').join('\n')
: this.props.information_block;
return information_block + '\n\n' + stripTags(this.props.content) + '\n' + this.props.signature['name'];
}
Expand Down

0 comments on commit 9d8e5bc

Please sign in to comment.