Skip to content

Commit

Permalink
Fix replacePlaceholder when text is null
Browse files Browse the repository at this point in the history
  • Loading branch information
kewers committed Aug 23, 2021
1 parent 55466fe commit 2167a7a
Showing 1 changed file with 6 additions and 2 deletions.
8 changes: 6 additions & 2 deletions index.js
Original file line number Diff line number Diff line change
Expand Up @@ -46,8 +46,12 @@ async function run() {
* @param {string} placeholder
* @returns {string}
*/
const replacePlaceholder = (text = '', placeholder = '') =>
text.replace(/(<!-- Replace -->)(.*)(<!-- Replace -->)/s, placeholder);
const replacePlaceholder = (text = '', placeholder = '') => {
if(text !== null) {
return text.replace(/(<!-- Replace -->)(.*)(<!-- Replace -->)/s, placeholder);
}
return ''
}

if (descriptionMessage) {
const descriptionWithPlaceholder = placeholderWrap(descriptionMessage)
Expand Down

0 comments on commit 2167a7a

Please sign in to comment.