2023-01-13 05:40:33 +01:00
|
|
|
import { substring } from "stringz";
|
2021-09-29 18:44:22 +02:00
|
|
|
|
|
|
|
export function truncate(input: string, size: number): string;
|
2023-01-13 05:40:33 +01:00
|
|
|
export function truncate(
|
|
|
|
input: string | undefined,
|
|
|
|
size: number,
|
|
|
|
): string | undefined;
|
|
|
|
export function truncate(
|
|
|
|
input: string | undefined,
|
|
|
|
size: number,
|
|
|
|
): string | undefined {
|
2021-09-29 18:44:22 +02:00
|
|
|
if (!input) {
|
|
|
|
return input;
|
|
|
|
} else {
|
|
|
|
return substring(input, 0, size);
|
|
|
|
}
|
|
|
|
}
|