31
loading...
This website collects cookies to deliver better user experience
const days = 2 // fetched from db
const message = `Your subscription will end in ${days} ${days > 1 ? "days" : "day"}`
2 day(s)
.tinyplural
.A noun is a word that refers to a thing (book), a person (Betty Crocker), an animal (cat), a place (Omaha), a quality (softness), an idea (justice), or an action (yodeling). It's usually a single word, but not always: cake, shoes, school bus, and time and a half are all nouns.
A word denoting more than one, or (in languages with dual number) more than two.
tinyplural("day", 2);
tinyplural("day", 1) // early escape, return original input
tinyplural("day", 2) // run the lookup
// first time
tinyplural("day", 2) // run the lookup
// second time
tinyplural("day", 2) // check the cache map, return the previous result