Skip to content

Commit

Permalink
Add default value for parameter
Browse files Browse the repository at this point in the history
  • Loading branch information
joemoongit committed Jun 30, 2023
1 parent edc9a28 commit d434591
Showing 1 changed file with 3 additions and 3 deletions.
6 changes: 3 additions & 3 deletions lib/recipe/htmlToTextObjects.js
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
const DOMParser = require("@xmldom/xmldom").DOMParser;

exports.htmlToTextObjects = function (htmlCodes, options) {
exports.htmlToTextObjects = function (htmlCodes, options = {}) {
htmlCodes = htmlCodes.replace(/<br\/?>/g, "<p>[@@DONOT_RENDER_THIS@@]</p>");
const nodes = new DOMParser().parseFromString(
`<html>${htmlCodes}</html>`,
Expand Down Expand Up @@ -82,15 +82,15 @@ function parseNode(node, options) {
const parsedData = {
value,
tag: node.tagName,
font: options ? options.font : undefined,
font: options.font,
isBold: isBoldTag(node.tagName),
isItalic: isItalicTag(node.tagName),
underline: node.tagName == "u",
strikeOut: node.tagName == "del",
attributes,
styles,
needsLineBreaker: needsLineBreaker(node.tagName),
size: options ? options.size : undefined,
size: options.size,
sizeRatio: getFontSizeRatio(node.tagName),
sizeRatios: [getFontSizeRatio(node.tagName)],
link: node.tagName == "a" ? node.attributes[0].value : null,
Expand Down

0 comments on commit d434591

Please sign in to comment.