Remove redundant sentanceEnders check to reduce false positive.
This commit is contained in:
parent
1d34a5989e
commit
f66bafc06b
@ -20,11 +20,10 @@ function analyzeHeaderLength(markdown: string): { hasLongHeaders: boolean; longH
|
|||||||
const sentenceEnders = /[.!?]+/g
|
const sentenceEnders = /[.!?]+/g
|
||||||
const sentences = headerText.split(sentenceEnders).filter((s) => s.trim().length > 0)
|
const sentences = headerText.split(sentenceEnders).filter((s) => s.trim().length > 0)
|
||||||
|
|
||||||
const hasSentenceEnders = sentenceEnders.test(headerText)
|
|
||||||
const isVeryLong = headerText.length > MAX_HEADER_LENGTH
|
const isVeryLong = headerText.length > MAX_HEADER_LENGTH
|
||||||
const hasMultipleSentences = sentences.length > 1
|
const hasMultipleSentences = sentences.length > 1
|
||||||
|
|
||||||
if (hasSentenceEnders || isVeryLong || hasMultipleSentences) {
|
if (isVeryLong || hasMultipleSentences) {
|
||||||
longHeaders.push(headerText)
|
longHeaders.push(headerText)
|
||||||
}
|
}
|
||||||
})
|
})
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user