{"id":15007966,"url":"https://github.com/betsol/numerous","last_synced_at":"2025-06-25T13:35:29.531Z","repository":{"id":29868559,"uuid":"33413693","full_name":"betsol/numerous","owner":"betsol","description":"Tiny pluralization library in JavaScript that supports almost any language","archived":false,"fork":false,"pushed_at":"2023-03-06T07:56:22.000Z","size":1274,"stargazers_count":23,"open_issues_count":3,"forks_count":4,"subscribers_count":2,"default_branch":"master","last_synced_at":"2025-02-12T11:10:21.474Z","etag":null,"topics":["i18n","internationalization","javascript","l10n","localization","npm-package","pluralization"],"latest_commit_sha":null,"homepage":"http://betsol.github.io/numerous/","language":"JavaScript","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":null,"status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/betsol.png","metadata":{"files":{"readme":"README.md","changelog":"CHANGELOG.md","contributing":null,"funding":null,"license":null,"code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null}},"created_at":"2015-04-04T17:21:16.000Z","updated_at":"2024-06-08T23:13:22.000Z","dependencies_parsed_at":"2024-06-18T22:55:31.609Z","dependency_job_id":null,"html_url":"https://github.com/betsol/numerous","commit_stats":{"total_commits":31,"total_committers":2,"mean_commits":15.5,"dds":"0.29032258064516125","last_synced_commit":"1b509aeebd54997e5e69f3295745b7e0adb941a1"},"previous_names":[],"tags_count":10,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/betsol%2Fnumerous","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/betsol%2Fnumerous/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/betsol%2Fnumerous/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/betsol%2Fnumerous/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/betsol","download_url":"https://codeload.github.com/betsol/numerous/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":238968295,"owners_count":19560586,"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":["i18n","internationalization","javascript","l10n","localization","npm-package","pluralization"],"created_at":"2024-09-24T19:14:40.130Z","updated_at":"2025-02-15T08:31:05.857Z","avatar_url":"https://github.com/betsol.png","language":"JavaScript","funding_links":[],"categories":[],"sub_categories":[],"readme":"\n# Numerous\n\n[![npm version](https://badge.fury.io/js/numerous.svg)][repo-npm]\n[![Build Status](https://travis-ci.com/betsol/numerous.svg?branch=master)](https://travis-ci.com/betsol/numerous)\n[![Maintainability](https://api.codeclimate.com/v1/badges/7a5986d640437b0949f2/maintainability)](https://codeclimate.com/github/betsol/numerous/maintainability)\n\n\nTiny pluralization library in JavaScript that supports almost any language.\n\nFor more details, please, read the article:\u003cbr\u003e\n[How to pluralize any word in different languages using JavaScript?][article]\n\n\n## Features\n\n- a completely stand-alone solution (no APIs or polyfills required)\n- supports **789** locales by means of [CLDR][lib-cldr] (built-in).\n  See the [complete list][locales]\n- could be run in Node.js or browser\n- very lightweight *(just ~300 Bytes compressed)*\n- almost no dependencies\n- TypeScript support out of the box\n\n\n## Demo\n\nPlease see [the demo][demo].\n\n\n## Install\n\n```shell\nnpm install --save numerous\n```\n\n\n## Usage\n\n### Node.js\n\nIn Node.js environment the library automatically loads\nthe required locales on first use.\n\n```js\nconst numerous = require('numerous');\n\n// Create an instance of Numerous using preferred locale\nconst { pluralize } = numerous.create('en');\n\n// Specify the list of variants\nconst variants = {\n  one: 'apple',\n  other: 'apples',\n};\n\n// Pluralize!\n\n// I have 1 apple\nconst applesCount = 1;\nconsole.log(`I have ${applesCount} ${pluralize(applesCount, variants)}`);\n\n// She had 5 apples\nconst applesCount = 5;\nconsole.log(`She had ${applesCount} ${pluralize(applesCount, variants)}`);\n```\n\n\n### Browser\n\nIn browser environment you need to load all the locales that you are\nplanning to use before initializing the instance of Numerous.\nThis is done in order to provide optimal bundle size.\n\n```js\nimport * as numerous from 'numerous';\n\nimport enLocale from 'numerous/locales/en';\nimport ruLocale from 'numerous/locales/ru';\n\n// Register single locale\nnumerous.registerLocale(enLocale);\n\n// Or register multiple locales at the same time\nnumerous.registerLocale([\n  enLocale,\n  ruLocale,\n]);\n\n// Create an instance of Numerous\n// using previously registered locale\nconst { pluralize } = numerous.create('en');\n\n// Specify the list of variants\nconst variants = {\n  one: 'apple',\n  other: 'apples',\n};\n\n// Pluralize!\n\n// I have 1 apple\nconst applesCount = 1;\nconsole.log(`I have ${applesCount} ${pluralize(applesCount, variants)}`);\n\n// She had 5 apples\nconst applesCount = 5;\nconsole.log(`She had ${applesCount} ${pluralize(applesCount, variants)}`);\n```\n\n\n### Without instantiating\n\nYou can use the library without instantiating it first.\nYou just need to specify the locale on each call.\n\n```js\n\n// \"apple\"\nnumerous.pluralize('en', 1, {\n  one: 'apple',\n  other: 'apples'\n});\n\n// \"cats\"\nnumerous.pluralize('en', 2, {\n  one: 'cat',\n  other: 'cats'\n});\n```\n\n## Examples\n\nPlease see [test files](./test) for more use cases.\n\n\n## Changelog\n\nPlease see the [complete changelog][changelog] for list of changes.\n\n\n## Contributors\n\n- [Slava Fomin II](https://github.com/slavafomin) (author)\n\n\n## Developer Guide\n\nFork, clone, create a feature branch, add tests, commit, create a PR.\n\nRun:\n\n- `npm install` to initialize the project\n- `npm run build-locales` to build fresh locales\n- `npm test` to test the library\n- `npm run demo:run` to run local webserver with demo page\n- `npm run demo:deploy` to deploy GitHub Pages\n\n\n## Feedback\n\nIf you have found a bug or have another issue with the library —\nplease [create an issue][new-issue].\n\nIf you have a question regarding the library or it's integration with your project —\nconsider asking a question at [StackOverflow][so-ask] and sending me a\nlink via [E-Mail][email]. I will be glad to help.\n\nHave any ideas or propositions? Feel free to contact me by [E-Mail][email].\n\nCheers!\n\n\n## Support\n\nIf you like this library consider to add star on [GitHub repository][repo-gh]\nand on [NPM][repo-npm].\n\nThank you!\n\n\n## License\n\nThe MIT License (MIT)\n\nⓒ 2015—2021 Slava Fomin II\n\nPermission is hereby granted, free of charge, to any person obtaining a copy\nof this software and associated documentation files (the \"Software\"), to deal\nin the Software without restriction, including without limitation the rights\nto use, copy, modify, merge, publish, distribute, sublicense, and/or sell\ncopies of the Software, and to permit persons to whom the Software is\nfurnished to do so, subject to the following conditions:\n\nThe above copyright notice and this permission notice shall be included in\nall copies or substantial portions of the Software.\n\nTHE SOFTWARE IS PROVIDED \"AS IS\", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR\nIMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,\nFITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE\nAUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER\nLIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,\nOUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN\nTHE SOFTWARE.\n\n\n  [changelog]: CHANGELOG.md\n  [contributors]: https://github.com/betsol/numerous/graphs/contributors\n  [so-ask]: http://stackoverflow.com/questions/ask?tags=node.js\n  [email]: mailto:slava@fomin.io\n  [new-issue]: https://github.com/betsol/numerous/issues/new\n  [locales]: docs/locales.md\n  [lib-cldr]: https://github.com/papandreou/node-cldr\n  [repo-gh]: https://github.com/betsol/numerous\n  [repo-npm]: https://www.npmjs.com/package/numerous\n  [demo]: http://betsol.github.io/numerous/\n  [article]: https://gist.github.com/slavafomin/f2e5259cab17d55af5d9fa4c2c2baa08\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fbetsol%2Fnumerous","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fbetsol%2Fnumerous","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fbetsol%2Fnumerous/lists"}