@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 +19 -2
- package/dist/index.cjs.map +1 -1
- package/dist/index.js +19 -2
- package/dist/index.js.map +1 -1
- package/package.json +3 -4
package/dist/index.js
CHANGED
|
@@ -47297,8 +47297,25 @@ var hasLetters = function(s) {
|
|
|
47297
47297
|
}
|
|
47298
47298
|
return false;
|
|
47299
47299
|
};
|
|
47300
|
-
var
|
|
47301
|
-
|
|
47300
|
+
var isSentencePunct = function(ch) {
|
|
47301
|
+
return ch === "." || ch === "!" || ch === "?" || ch === "\u3002" || ch === "\uFF01" || ch === "\uFF1F";
|
|
47302
|
+
};
|
|
47303
|
+
var normalizeBoundaries = function(text) {
|
|
47304
|
+
var out = "";
|
|
47305
|
+
for(var i = 0; i < text.length; i++){
|
|
47306
|
+
var ch = text.charAt(i);
|
|
47307
|
+
out += ch;
|
|
47308
|
+
if (isSentencePunct(ch)) {
|
|
47309
|
+
var next = text.charAt(i + 1);
|
|
47310
|
+
if (next && next !== " " && hasLetters(next)) {
|
|
47311
|
+
out += " ";
|
|
47312
|
+
}
|
|
47313
|
+
}
|
|
47314
|
+
}
|
|
47315
|
+
return out;
|
|
47316
|
+
};
|
|
47317
|
+
var splitSentencesFast = function(raw) {
|
|
47318
|
+
var t = normalizeBoundaries(raw.replace(/\s+/g, " ").trim());
|
|
47302
47319
|
if (!t) return [];
|
|
47303
47320
|
var parts = t.split(RegExp("(?<=[.!?])\\s+(?=[^\\s])", "g"));
|
|
47304
47321
|
var filtered = [];
|