{"id":25441032,"url":"https://github.com/bhznjns/multi-counter","last_synced_at":"2026-02-18T00:01:20.472Z","repository":{"id":251927902,"uuid":"838869931","full_name":"BHznJNs/multi-counter","owner":"BHznJNs","description":"A simple and light-weight word counter with multi-language support.","archived":false,"fork":false,"pushed_at":"2025-02-11T13:24:53.000Z","size":34,"stargazers_count":0,"open_issues_count":0,"forks_count":0,"subscribers_count":1,"default_branch":"master","last_synced_at":"2025-09-29T10:55:06.986Z","etag":null,"topics":["internationalization","multilanguage-support","word-counter","wordcounter"],"latest_commit_sha":null,"homepage":"","language":"JavaScript","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"gpl-3.0","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/BHznJNs.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,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null,"zenodo":null}},"created_at":"2024-08-06T13:59:24.000Z","updated_at":"2025-02-11T13:24:59.000Z","dependencies_parsed_at":"2025-02-11T14:23:49.638Z","dependency_job_id":"ad84d2a6-4468-4e6e-bc02-2749e2e3466f","html_url":"https://github.com/BHznJNs/multi-counter","commit_stats":null,"previous_names":["bhznjns/multi-counter","bhznjns/multilang-counter"],"tags_count":0,"template":false,"template_full_name":null,"purl":"pkg:github/BHznJNs/multi-counter","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/BHznJNs%2Fmulti-counter","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/BHznJNs%2Fmulti-counter/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/BHznJNs%2Fmulti-counter/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/BHznJNs%2Fmulti-counter/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/BHznJNs","download_url":"https://codeload.github.com/BHznJNs/multi-counter/tar.gz/refs/heads/master","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/BHznJNs%2Fmulti-counter/sbom","scorecard":null,"host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":286080680,"owners_count":29563260,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2026-02-17T21:50:49.831Z","status":"ssl_error","status_checked_at":"2026-02-17T21:46:15.313Z","response_time":100,"last_error":"SSL_connect returned=1 errno=0 peeraddr=140.82.121.6:443 state=error: unexpected eof while reading","robots_txt_status":"success","robots_txt_updated_at":"2025-07-24T06:49:26.215Z","robots_txt_url":"https://github.com/robots.txt","online":false,"can_crawl_api":true,"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":["internationalization","multilanguage-support","word-counter","wordcounter"],"created_at":"2025-02-17T12:19:27.923Z","updated_at":"2026-02-18T00:01:20.425Z","avatar_url":"https://github.com/BHznJNs.png","language":"JavaScript","funding_links":[],"categories":[],"sub_categories":[],"readme":"# multi-counter\n\nA simple and light-weight word counter and reading time calculator with multi-language support.\n\n## Example\n\nCount words in a paragraph:\n\n```javascript\nimport { countWords } from \"multilang-counter\"\n\ncountWords(\"Hello World!\") // 2\ncountWords(\"你好，世界！\") // 4\ncountWords(\"こんにちは、世界!\") // 7\ncountWords(\"مرحبا، بالعالم!\") // 2\ncountWords(\"Привет, мир!\") // 2\n\n// for mixed paragraph\ncountWords(\"Hello World! 你好，世界！\") // 6\n```\n\nEliminate the required reading time for a paragraph:\n\n```javascript\nimport { readingTime } from \"multilang-counter\"\n\n// returns 4 with a unit of minutes, since the default reading rate is 300 words per min.\nreadingTime(\"...a paragraph with 1200 words...\")\n\n// returns 3 with a unit of minutes, since the reading rate is set to 400 words per min.\nreadingTime(\"...a paragraph with 1200 words...\", 400)\n\n// use different reading rate to the different languages in a paragraph\nreadingTime(\"...a paragraph consists of multiple languages...\", {\n    cjk: 300, // Chinese, Japanese, Korean\n    eu: 250,  // European languages\n    gr: 250,  // Greek\n    ar: 250,  // Arabic\n    cy: 250,  // Cyrillic\n    num: 300, // Number\n})\n```\n\n## Usage\n\n### Install \u0026 Import\n\n```bash\nnpm i @bhznjns/multi-counter\n```\n\n```javascript\nimport { countWords, readingTime, tokenize } from \"@bhznjns/multi-counter\"\n```\n\n### API\n\n|    Method    | Description | Arguments |\n|     ---      |     ---     |    ---    |\n| `countWords` | Calculates the number of words in a given string | `text` |\n| `readingTime` | Estimates the required reading time for a given string  | `text`, `wordsPerMin` |\n| `tokenize` | Tokenizes multi-lingual text, separating CJK by characters and others by words, excluding punctuation | `text` |\n\n#### wordsPerMin: ReadingRate\n\n```typescript\ntype ReadingRate = number | {\n    cjk?: number,\n    eu?: number,\n    gr?: number,\n    ar?: number,\n    cy?: number,\n    num?: number,\n    default?: number,\n}\n```\n\nCan be a number or an object.\n\ndefault: `300`\n\nWhen it is a number, the `readingTime` applies the same reading rate to scripts of all languages; When it is a object, the reading rate of the given field will be applied to the corresponding language.\n\n- `cjk` -\u003e Chinese, Japanese, Korean\n- `eu` -\u003e European languages\n- `gr` -\u003e Greek\n- `ar` -\u003e Arabic\n- `cy` -\u003e Cyrillic\n- `num` -\u003e Number\n- `default` -\u003e Default value to fields above, if it is undefined, it will be set to `300`\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fbhznjns%2Fmulti-counter","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fbhznjns%2Fmulti-counter","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fbhznjns%2Fmulti-counter/lists"}