utility-function-extractor/packages/webpage-refactor/lib/stringManipulations.js
2022-06-19 19:25:55 -04:00

12 lines
246 B
JavaScript

export const cutOffLongNames = (string) => {
let maxLength = 40;
let result;
if (string.length < maxLength) {
result = string;
} else {
result = string.slice(0, maxLength - 4);
result = result + "...";
}
return result;
};