Skip to content

Commit

Permalink
changed regex to matchAll
Browse files Browse the repository at this point in the history
  • Loading branch information
ChrisDryden committed Apr 7, 2022
1 parent dbec8b2 commit b7ff839
Showing 1 changed file with 3 additions and 10 deletions.
13 changes: 3 additions & 10 deletions src/rules/requireDescriptionCompleteSentence.js
Original file line number Diff line number Diff line change
Expand Up @@ -22,16 +22,9 @@ const extractSentences = (text, abbreviationsRegex) => {
// Remove custom abbreviations
.replace(abbreviationsRegex, '');

const sentenceEndGrouping = /([.?!])(?:\s+|$)/u;

const puncts = [];
let matches;
let n0;
let index = 0;
while ((matches = sentenceEndGrouping.exec(txt)) !== null) {
n0 = matches.splice(0, 1);
puncts.push(matches.concat(index++, n0));
}
const sentenceEndGrouping = /([.?!])(?:\s+|$)/ug;

const puncts = txt.matchAll(sentenceEndGrouping);

return txt

Expand Down

0 comments on commit b7ff839

Please sign in to comment.