hierarchical-estimates-visu.../packages/webpage-refactor/lib/stringManipulations.js

12 lines
246 B
JavaScript
Raw Normal View History

2022-06-19 23:25:55 +00:00
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;
};