MCPcopy
hub / github.com/stackshareio/awesome-stacks / truncate

Function truncate

src/utils.js:1–3  ·  view source on GitHub ↗
(str, limit = 12)

Source from the content-addressed store, hash-verified

1export function truncate(str, limit = 12) {
2 return str && str.length > limit ? `${str.substring(0, limit).trim()}…` : str
3}
4
5export function shortenLargeNumber(num, digits) {
6 var units = ['k', 'M', 'G', 'T', 'P', 'E', 'Z', 'Y'],

Callers 1

github-card.jsFile · 0.90

Calls

no outgoing calls

Tested by

no test coverage detected