Files
dotfiles/home/natto/ags/utils/text.js
2024-06-01 18:10:31 +05:30

6 lines
143 B
JavaScript

export const shrinkText = (str, n) => {
let newStr = str.substring(0, n);
if (str.length > n) newStr = newStr + "...";
return newStr;
};