@tryghost/helpers 1.1.68 → 1.1.71

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/cjs/helpers.js CHANGED
@@ -3554,7 +3554,11 @@ function countWords(text) {
3554
3554
  text = text.replace(/<(.|\n)*?>/g, ' '); // strip any HTML tags
3555
3555
 
3556
3556
  const pattern = /[a-zA-ZÀ-ÿ0-9_\u0392-\u03c9\u0410-\u04F9]+|[\u4E00-\u9FFF\u3400-\u4dbf\uf900-\ufaff\u3040-\u309f\uac00-\ud7af]+/g;
3557
- const match = text.match(pattern);
3557
+
3558
+ const RTLPattern = /([\u0600-\u06ff]+|[\u0591-\u05F4]+)/g;
3559
+
3560
+ const match = text.match(pattern) || text.match(RTLPattern);
3561
+
3558
3562
  let count = 0;
3559
3563
 
3560
3564
  if (match === null) {
package/es/helpers.js CHANGED
@@ -3558,7 +3558,8 @@ function countWords(text) {
3558
3558
  text = text.replace(/<(.|\n)*?>/g, ' '); // strip any HTML tags
3559
3559
 
3560
3560
  var pattern = /[a-zA-ZÀ-ÿ0-9_\u0392-\u03c9\u0410-\u04F9]+|[\u4E00-\u9FFF\u3400-\u4dbf\uf900-\ufaff\u3040-\u309f\uac00-\ud7af]+/g;
3561
- var match = text.match(pattern);
3561
+ var RTLPattern = /([\u0600-\u06ff]+|[\u0591-\u05F4]+)/g;
3562
+ var match = text.match(pattern) || text.match(RTLPattern);
3562
3563
  var count = 0;
3563
3564
 
3564
3565
  if (match === null) {