UNPKG

@eslam-elmeniawy/react-native-common-components

Version:

Common `ReactNative` components packed in library for usage in projects.

16 lines (15 loc) 634 B
"use strict"; Object.defineProperty(exports, "__esModule", { value: true }); exports.trimStringToLength = void 0; /** * Trims a given string to a specified length, appending '...' if the string exceeds the length. * * @param string - The string to be trimmed. * @param length - The maximum length of the trimmed string, default is 45. * @returns The trimmed string, with '...' appended if it was truncated. */ const trimStringToLength = (string, length = 45) => string.length > length ? string.substring(0, length - 3) + '...' : string; exports.trimStringToLength = trimStringToLength; //# sourceMappingURL=StringUtils.js.map