Created
September 27, 2019 18:02
-
-
Save siman/1c65ae645b595cbd2890205adf51a066 to your computer and use it in GitHub Desktop.
This file contains hidden or 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
function pluralize(count: number | BN, singluarText: string, plularText?: string) { | |
count = typeof count !== 'number' ? count.toNumber() : count; | |
const plural = () => !plularText ? singluarText + 's' : singluarText; | |
const text = count === 1 ? singluarText : plural() | |
return <><b>{count}</b> {text}</> | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment