UNPKG

@swimlane/ngx-charts

Version:

Declarative Charting Framework for Angular2 and beyond!

16 lines (14 loc) 271 B
export function trimLabel(s, max = 16): string { if(typeof s !== 'string') { if(typeof s === 'number') { return s + ''; } else { return ''; } } if(s.length <= max) { return s; } else { return `${s.slice(0, max).trim()}...`; } }