@superinterface/react 5.3.0-beta.5 → 5.3.0-beta.6

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/dist/index.cjs CHANGED
@@ -47446,8 +47446,25 @@ var hasLetters = function(s) {
47446
47446
  }
47447
47447
  return false;
47448
47448
  };
47449
- var splitSentencesFast = function(text) {
47450
- var t = text.replace(/\s+/g, " ").trim();
47449
+ var isSentencePunct = function(ch) {
47450
+ return ch === "." || ch === "!" || ch === "?" || ch === "\u3002" || ch === "\uFF01" || ch === "\uFF1F";
47451
+ };
47452
+ var normalizeBoundaries = function(text) {
47453
+ var out = "";
47454
+ for(var i = 0; i < text.length; i++){
47455
+ var ch = text.charAt(i);
47456
+ out += ch;
47457
+ if (isSentencePunct(ch)) {
47458
+ var next = text.charAt(i + 1);
47459
+ if (next && next !== " " && hasLetters(next)) {
47460
+ out += " ";
47461
+ }
47462
+ }
47463
+ }
47464
+ return out;
47465
+ };
47466
+ var splitSentencesFast = function(raw) {
47467
+ var t = normalizeBoundaries(raw.replace(/\s+/g, " ").trim());
47451
47468
  if (!t) return [];
47452
47469
  var parts = t.split(RegExp("(?<=[.!?])\\s+(?=[^\\s])", "g"));
47453
47470
  var filtered = [];