{"id":22469198,"url":"https://github.com/mauroerta/deno-plural","last_synced_at":"2025-08-02T08:33:11.355Z","repository":{"id":38241779,"uuid":"273967340","full_name":"mauroerta/deno-plural","owner":"mauroerta","description":"deno-plural module helps you to pluralize or singularize a given word.","archived":false,"fork":false,"pushed_at":"2022-06-08T12:01:40.000Z","size":31,"stargazers_count":3,"open_issues_count":0,"forks_count":1,"subscribers_count":1,"default_branch":"master","last_synced_at":"2024-11-17T05:43:14.503Z","etag":null,"topics":["deno","module","pluralization","pluralize","singularize","typescript"],"latest_commit_sha":null,"homepage":"","language":"TypeScript","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"mit","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/mauroerta.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":"LICENSE","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null}},"created_at":"2020-06-21T19:07:27.000Z","updated_at":"2022-04-24T10:35:57.000Z","dependencies_parsed_at":"2022-09-04T22:12:57.233Z","dependency_job_id":null,"html_url":"https://github.com/mauroerta/deno-plural","commit_stats":null,"previous_names":[],"tags_count":4,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/mauroerta%2Fdeno-plural","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/mauroerta%2Fdeno-plural/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/mauroerta%2Fdeno-plural/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/mauroerta%2Fdeno-plural/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/mauroerta","download_url":"https://codeload.github.com/mauroerta/deno-plural/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":228456833,"owners_count":17923118,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":["deno","module","pluralization","pluralize","singularize","typescript"],"created_at":"2024-12-06T11:27:26.309Z","updated_at":"2024-12-06T11:27:26.926Z","avatar_url":"https://github.com/mauroerta.png","language":"TypeScript","funding_links":[],"categories":[],"sub_categories":[],"readme":"[![GitHub issues](https://img.shields.io/github/issues/mauroerta/deno-plural)](https://github.com/mauroerta/deno-plural/issues)\n[![GitHub forks](https://img.shields.io/github/forks/mauroerta/deno-plural)](https://github.com/mauroerta/deno-plural/network)\n[![GitHub stars](https://img.shields.io/github/stars/mauroerta/deno-plural)](https://github.com/mauroerta/deno-plural/stargazers)\n[![GitHub license](https://img.shields.io/github/license/mauroerta/deno-plural)](https://github.com/mauroerta/deno-plural/blob/master/LICENSE)\n\n# Deno Plural ~ 🙏🏻 = 🍞 🐟\n\ndeno-plural module helps you to pluralize or singularize a given word.\n\n## 📝 How to use\n\nYou just need to import the singular and plural functions from `deno.land`:\n\n```typescript\nimport { plural, singular } from \"https://deno.land/x/deno_plural/mod.ts\";\n```\n\nAnd use it!\n\n```typescript\nconst pluralWord = plural(`foot`); // Will return the string  `feet`\nconst singularWord = singular(`feet`); // Will return the string `foot`\n```\n\n## 🤓 Advanced\n\n### Add a new Language\n\n```typescript\nimport {\n  addRules,\n  plural,\n  setLanguage,\n  singular,\n} from \"https://deno.land/x/deno_plural/mod.ts\";\nimport itRules from \"./myCustomRules/it.ts\";\n\naddRules(\"it\", itRules);\n\nsetLanguage(\"it\");\n\nconst pluralWord = plural(`persona`); // Will return the string  `persone`\nconst singularWord = singular(`persone`); // Will return the string `persona`\n```\n\nDon't forget to also augment the type definition or Typescript will complain!\n\n```typescript\ndeclare module \"https://deno.land/x/deno_plural/mod.ts\" {\n  interface Languages {\n    it: string;\n  }\n}\n```\n\n### Use another language one-time\n\n```typescript\nimport { plural, singular } from \"https://deno.land/x/deno_plural/mod.ts\";\n\nconst pluralWord = plural(`persona`, \"it\"); // Will return the string  `persone`\nconst singularWord = singular(`people`); // Will return the string `person`\n```\n\n## 🎓 Example\n\n```typescript\nimport { plural, singular } from \"https://deno.land/x/deno_plural/mod.ts\";\n\nconst singulars = [\"foot\", \"computer\"];\n\nlet plurals: string[] = [];\n\nconsole.log(\"Testing singular --\u003e plural\");\nsingulars.forEach((word) =\u003e {\n  const pluralWord = plural(word);\n  plurals.push(pluralWord);\n  console.log(`The plural of ${word} is ${pluralWord}`);\n});\nconsole.log(\"---------------------------\");\nconsole.log(\"Testing plural --\u003e singular\");\nplurals.forEach((word) =\u003e {\n  console.log(`The singular of ${word} is ${singular(word)}`);\n});\n```\n\nThe output of this simple code will be:\n\n```\nTesting singular --\u003e plural\nThe plural of foot is feet\nThe plural of computer is computers\n---------------------------\nTesting plural --\u003e singular\nThe singular of feet is foot\nThe singular of computers is computer\n```\n\n## 🙏 Thanks\n\nThis project could not exist without the work of\n[pluralize](https://github.com/plurals/pluralize).\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fmauroerta%2Fdeno-plural","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fmauroerta%2Fdeno-plural","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fmauroerta%2Fdeno-plural/lists"}