gcg-website/static/admin/previews/field-previews/components/truncate.js
2023-05-29 16:22:34 +02:00

10 lines
153 B
JavaScript

function truncate(str, num) {
if (str.length > num) {
return str.slice(0, num) + "...";
} else {
return str;
}
}
export default truncate;