GitHub issues GitHub forks GitHub stars GitHub license

Deno Plural ~ 🙏🏻 = 🍞 🐟

deno-plural module helps you to pluralize or singularize a given word.

📝 How to use

You just need to import the singular and plural functions from deno.land:

import { singular, plural } from "https://deno.land/x/deno_plural/mod.ts";

And use it!

const pluralWord = plural(`foot`); // Will return the string  `feet`
const singularWord = singular(`feet`); // Will return the string `foot`

🎓 Example

import { singular, plural } from "https://deno.land/x/deno_plural/mod.ts";

const singulars = ["foot", "computer"];

let plurals: string[] = [];

console.log("Testing singular --> plural");
singulars.forEach((word) => {
  const pluralWord = plural(word);
  plurals.push(pluralWord);
  console.log(`The plural of <span class="katex"><span class="katex-mathml"><math xmlns="http://www.w3.org/1998/Math/MathML"><semantics><mrow><mrow><mi>w</mi><mi>o</mi><mi>r</mi><mi>d</mi></mrow><mi>i</mi><mi>s</mi></mrow><annotation encoding="application/x-tex">{word} is </annotation></semantics></math></span><span class="katex-html" aria-hidden="true"><span class="base"><span class="strut" style="height:0.6944em;"></span><span class="mord"><span class="mord mathnormal" style="margin-right:0.02691em;">w</span><span class="mord mathnormal" style="margin-right:0.02778em;">or</span><span class="mord mathnormal">d</span></span><span class="mord mathnormal">i</span><span class="mord mathnormal">s</span></span></span></span>{pluralWord}`);
});
console.log("---------------------------");
console.log("Testing plural --> singular");
plurals.forEach((word) => {
  console.log(`The singular of <span class="katex"><span class="katex-mathml"><math xmlns="http://www.w3.org/1998/Math/MathML"><semantics><mrow><mrow><mi>w</mi><mi>o</mi><mi>r</mi><mi>d</mi></mrow><mi>i</mi><mi>s</mi></mrow><annotation encoding="application/x-tex">{word} is </annotation></semantics></math></span><span class="katex-html" aria-hidden="true"><span class="base"><span class="strut" style="height:0.6944em;"></span><span class="mord"><span class="mord mathnormal" style="margin-right:0.02691em;">w</span><span class="mord mathnormal" style="margin-right:0.02778em;">or</span><span class="mord mathnormal">d</span></span><span class="mord mathnormal">i</span><span class="mord mathnormal">s</span></span></span></span>{singular(word)}`);
});

The output of this simple code will be:

Testing singular --> plural
The plural of foot is feet
The plural of computer is computers
---------------------------
Testing plural --> singular
The singular of feet is foot
The singular of computers is computer

🙏 Thanks

This project could not exist without the work of pluralize.