@kontur.candy/generator 6.24.0-test-fs-9450.0 → 6.24.0
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.js +12 -1
- package/package.json +1 -1
package/dist/index.js
CHANGED
|
@@ -113175,10 +113175,21 @@ __webpack_require__.r(__webpack_exports__);
|
|
|
113175
113175
|
/* harmony export */ HelperFunctionsStringHelpers: () => (/* binding */ HelperFunctionsStringHelpers),
|
|
113176
113176
|
/* harmony export */ pluralize: () => (/* binding */ pluralize),
|
|
113177
113177
|
/* harmony export */ splitHighlightedParts: () => (/* binding */ splitHighlightedParts),
|
|
113178
|
-
/* harmony export */ splitLastOccurrence: () => (/* binding */ splitLastOccurrence)
|
|
113178
|
+
/* harmony export */ splitLastOccurrence: () => (/* binding */ splitLastOccurrence),
|
|
113179
|
+
/* harmony export */ truncateText: () => (/* binding */ truncateText)
|
|
113179
113180
|
/* harmony export */ });
|
|
113180
113181
|
/* harmony import */ var _Common_IntRangeUtils__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! ../../../Common/IntRangeUtils */ "./Common/IntRangeUtils.ts");
|
|
113181
113182
|
|
|
113183
|
+
const truncateText = (text, maxLength = 40) => {
|
|
113184
|
+
if (!text) {
|
|
113185
|
+
return "";
|
|
113186
|
+
}
|
|
113187
|
+
if (text.length <= maxLength) {
|
|
113188
|
+
return text;
|
|
113189
|
+
}
|
|
113190
|
+
const half = Math.floor(maxLength / 2);
|
|
113191
|
+
return `${text.slice(0, half)}…${text.slice(-half)}`;
|
|
113192
|
+
};
|
|
113182
113193
|
const splitLastOccurrence = (source, substring) => {
|
|
113183
113194
|
const lastIndex = source.lastIndexOf(substring);
|
|
113184
113195
|
let before = "";
|