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.
- package/.vscode/settings.json +3 -1
- package/dist/cjs/index.js +22 -0
- package/dist/cjs/index.js.map +1 -1
- package/dist/cjs/types/helpers/getWordCount.d.ts +10 -0
- package/dist/cjs/types/index.d.ts +2 -1
- package/dist/esm/index.js +22 -1
- package/dist/esm/index.js.map +1 -1
- package/dist/esm/types/helpers/getWordCount.d.ts +10 -0
- package/dist/esm/types/index.d.ts +2 -1
- package/dist/index.d.ts +11 -1
- package/package.json +1 -1
- package/src/helpers/getWordCount.ts +26 -0
- package/src/index.ts +2 -0
package/.vscode/settings.json
CHANGED
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;
|