Sha256: 18e253a272f8fc87c2a0cc6a286716a3bce34b49f098b4d57dcfdb109831fda8
Contents?: true
Size: 557 Bytes
Versions: 375
Compression:
Stored size: 557 Bytes
Contents
const children = Array.from(node.parentNode.childNodes); const nodeText = node.textContent.trim(); const isSentence = /[.!?:;](?![.!?:;])/g; // Check that there is text, and it is not more than a single sentence if (nodeText.length === 0 || (nodeText.match(isSentence) || []).length >= 2) { return false; } // Grab sibling p element following the current node const siblingsAfter = children .slice(children.indexOf(node) + 1) .filter( elm => elm.nodeName.toUpperCase() === 'P' && elm.textContent.trim() !== '' ); return siblingsAfter.length !== 0;
Version data entries
375 entries across 375 versions & 1 rubygems