Created
May 13, 2020 07:01
-
-
Save natterstefan/345c47230822e318c60213941965e473 to your computer and use it in GitHub Desktop.
@types/ellipsize
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
/** | |
* custom ellipsize typings - tested with ellipsize@0.1.0 | |
*/ | |
declare module 'ellipsize' { | |
/** | |
* @param text text to ellipsize | |
* @param maxLength of the text before it is ellipsized | |
* @param options | |
*/ | |
function ellipsize( | |
text: string, | |
maxLength: number, | |
options: { | |
/** | |
* breakpoints - after this char the ellipse can be rendered | |
*/ | |
chars?: string[] | |
/** | |
* custom ellipse element | |
* @default '...' | |
*/ | |
ellipse?: string | |
/** | |
* truncate words or not | |
* @default: true | |
*/ | |
truncate?: boolean | |
}, | |
): string | |
export default ellipsize | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment