export const truncatedJsonStringify = (obj, lengthLimit = 1000, tailLength = 10) => {
    let stringified;
    try {
        stringified = JSON.stringify(obj);
    }
    catch {
        // For very large objects, JSON.stringify may throw an error.
        return '<Truncated Large Object>';
    }
    if (stringified === undefined || stringified.length < lengthLimit) {
        return stringified;
    }
    return (stringified.substring(0, lengthLimit - tailLength) +
        '<… TRUNCATED …>' +
        stringified.substring(stringified.length - tailLength, stringified.length));
};
export const truncateString = (text, maxLength, omission = '...') => {
    if (maxLength <= omission.length) {
        return omission.slice(0, maxLength);
    }
    if (text.length <= maxLength) {
        return text;
    }
    return text.slice(0, maxLength - omission.length) + omission;
};
export const truncateCommitId = (commitId) => {
    return commitId.slice(0, 7);
};
//# sourceMappingURL=truncate.js.map