@oslokommune/punkt-elements
Version:
Komponentbiblioteket til Punkt, et designsystem laget av Oslo Origo
14 lines (13 loc) • 562 B
TypeScript
/**
* Decide how to split a filename for middle-truncation (head + fixed-length tail,
* so the extension stays visible).
*
* Returns `null` when no split should happen — either the caller didn't ask for
* a tail, or the filename is so short that splitting would produce visual noise
* (we use a threshold of `tail + 3` characters, same as the React Truncate
* component has used since it was introduced).
*/
export declare function splitFilenameForTruncation(filename: string, tail: number | undefined): {
head: string;
tail: string;
} | null;