dce-reactkit 3.11.3 → 3.11.4

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.
@@ -1,10 +1,12 @@
1
1
  {
2
2
  "cSpell.words": [
3
3
  "Copiable",
4
+ "Gabe",
4
5
  "Intelli",
5
6
  "pickable",
6
7
  "Subcontext",
7
8
  "subcontexts",
8
- "Uncategorized"
9
+ "Uncategorized",
10
+ "Zhang"
9
11
  ]
10
12
  }
package/dist/cjs/index.js CHANGED
@@ -16402,6 +16402,27 @@ const visitEndpointOnAnotherServer = (opts) => __awaiter(void 0, void 0, void 0,
16402
16402
  return body;
16403
16403
  });
16404
16404
 
16405
+ const punctuationRegex = /[!@#$%^&*(),.?\/;:'"\-\[\]]/g;
16406
+ /**
16407
+ * Get number of words in string
16408
+ * @author Gardenia Liu
16409
+ * @author Allison Zhang
16410
+ * @author Gabe Abrams
16411
+ * @param text the string to check
16412
+ * @returns number of words in the string
16413
+ */
16414
+ const getWordCount = (text) => {
16415
+ const trimmedTextWithoutPunctuation = (text
16416
+ // Remove leading and trailing whitespace
16417
+ .trim()
16418
+ // Remove punctuation
16419
+ .replace(punctuationRegex, ''));
16420
+ if (trimmedTextWithoutPunctuation.length === 0) {
16421
+ return 0;
16422
+ }
16423
+ return trimmedTextWithoutPunctuation.split(/\s+/g).length;
16424
+ };
16425
+
16405
16426
  /**
16406
16427
  * Days of the week
16407
16428
  * @author Gabe Abrams
@@ -16486,6 +16507,7 @@ exports.getMonthName = getMonthName;
16486
16507
  exports.getOrdinal = getOrdinal;
16487
16508
  exports.getPartOfDay = getPartOfDay;
16488
16509
  exports.getTimeInfoInET = getTimeInfoInET;
16510
+ exports.getWordCount = getWordCount;
16489
16511
  exports.handleError = handleError;
16490
16512
  exports.handleSuccess = handleSuccess;
16491
16513
  exports.idify = idify;