All Downloads are FREE. Search and download functionalities are using the official Maven repository.

utils.declensionNoun.ts Maven / Gradle / Ivy

There is a newer version: 7.28.3
Show newest version
export default function getNoun(number: number, one: string, two: string, five: string) {
    let n = Math.abs(number)

    n %= 100
    if (n >= 5 && n <= 20) {
        return five
    }
    n %= 10
    if (n === 1) {
        return one
    }
    if (n >= 2 && n <= 4) {
        return two
    }

    return five
}




© 2015 - 2025 Weber Informatics LLC | Privacy Policy