Skip to content

Commit

Permalink
eslint adjust better readability
Browse files Browse the repository at this point in the history
  • Loading branch information
ryanmparrish committed Mar 27, 2024
1 parent e865882 commit afc010b
Showing 1 changed file with 5 additions and 2 deletions.
7 changes: 5 additions & 2 deletions libs/blocks/share/share.js
Original file line number Diff line number Diff line change
Expand Up @@ -57,8 +57,11 @@ export default async function decorate(block) {
const rows = block.querySelectorAll(':scope > div');
const childDiv = rows[0].querySelector(':scope > div');
const emptyRow = childDiv?.innerText.trim() === '';
/* eslint-disable no-confusing-arrow,no-useless-escape */
const toSentenceCase = (str) => str && typeof str === 'string' ? str.toLowerCase().replace(/(^\s*\w|[\.\!\?]\s*\w)/g, (c) => c.toUpperCase()) : '';
const toSentenceCase = (str) => {
if (!str || typeof str !== 'string') return '';
/* eslint-disable-next-line no-useless-escape */
return str.toLowerCase().replace(/(^\s*\w|[\.\!\?]\s*\w)/g, (c) => c.toUpperCase());
};

if (block.classList.contains('inline')) {
rows[0].innerHTML = '';
Expand Down

0 comments on commit afc010b

Please sign in to comment.