blob: c2bf71a7af7383a3c872f3505234d8e3b9925891 (
plain)
1
2
3
4
5
6
7
|
export const ellipsize = (str: string, len: number) => (str.length > len ? `${str.slice(0, len - 1)}…` : str);
export const basename = (path: string) => {
const lastSlash = path.lastIndexOf("/");
const lastDot = path.lastIndexOf(".");
return path.slice(lastSlash + 1, lastDot > lastSlash ? lastDot : undefined);
};
|