Created
August 2, 2016 11:32
-
-
Save amcdnl/ec2347fbbe9384eeb4dfc1aee7a62d5f to your computer and use it in GitHub Desktop.
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 function truncate(text, length) { | |
if (text.toString().length > length) { | |
return text.toString().substring(0, length) + "..."; | |
} else { | |
return text; | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment