@clickup/rest-client
Version:
A syntax sugar tool around Node fetch() API, tailored to work with TypeScript and response validators
17 lines • 578 B
JavaScript
Object.defineProperty(exports, "__esModule", { value: true });
const ELLIPSIS = "…";
/**
* The fastest possible version of truncation. Lodash'es truncate() messes up
* with unicode a lot, so for e.g. logging purposes, it's super-slow.
*/
function ellipsis(string, length) {
string = ("" + string).trimEnd();
length = Math.max(length, ELLIPSIS.length);
if (string.length <= length) {
return string;
}
return string.substring(0, length - ELLIPSIS.length) + ELLIPSIS;
}
exports.default = ellipsis;
//# sourceMappingURL=ellipsis.js.map
;