Last active
September 26, 2022 07:45
-
-
Save rimzzlabs/8df26ac98222ecb5473d004e4793e7a2 to your computer and use it in GitHub Desktop.
given number length, make the string ellipsis
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
export const toElipsis = (str: string, range?: = 10): string => { | |
return str.slice(0, range) + '...' | |
} | |
// usage | |
const elipsis = toElipsis("Please mister, call me Robin, I will be your company while at your trip to Mongo Island", 44) | |
console.info(elipsis) // -> 'Please mister, call me robin, I will be your...' |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment