{"id":30586173,"url":"https://github.com/janlelis/unicode-category.js","last_synced_at":"2025-08-29T11:44:04.460Z","repository":{"id":257855768,"uuid":"873652879","full_name":"janlelis/unicode-category.js","owner":"janlelis","description":"Get the General Category of a Unicode character","archived":false,"fork":false,"pushed_at":"2024-10-16T14:20:36.000Z","size":14,"stargazers_count":2,"open_issues_count":0,"forks_count":0,"subscribers_count":1,"default_branch":"main","last_synced_at":"2025-08-25T23:29:31.002Z","etag":null,"topics":["cased-characters","control-characters","general-category","javascript","letters","strings","unicode","unicode-characters"],"latest_commit_sha":null,"homepage":"https://character.construction","language":"JavaScript","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/janlelis.png","metadata":{"files":{"readme":"README.md","changelog":"CHANGELOG.md","contributing":null,"funding":null,"license":"MIT-LICENSE.txt","code_of_conduct":"CODE_OF_CONDUCT.md","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":"2024-10-16T14:14:40.000Z","updated_at":"2024-10-16T18:15:09.000Z","dependencies_parsed_at":"2024-10-18T06:55:19.412Z","dependency_job_id":null,"html_url":"https://github.com/janlelis/unicode-category.js","commit_stats":null,"previous_names":["janlelis/unicode-category.js"],"tags_count":1,"template":false,"template_full_name":null,"purl":"pkg:github/janlelis/unicode-category.js","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/janlelis%2Funicode-category.js","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/janlelis%2Funicode-category.js/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/janlelis%2Funicode-category.js/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/janlelis%2Funicode-category.js/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/janlelis","download_url":"https://codeload.github.com/janlelis/unicode-category.js/tar.gz/refs/heads/main","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/janlelis%2Funicode-category.js/sbom","scorecard":null,"host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":272679418,"owners_count":24975255,"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","status":"online","status_checked_at":"2025-08-29T02:00:10.610Z","response_time":87,"last_error":null,"robots_txt_status":"success","robots_txt_updated_at":"2025-07-24T06:49:26.215Z","robots_txt_url":"https://github.com/robots.txt","online":true,"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":["cased-characters","control-characters","general-category","javascript","letters","strings","unicode","unicode-characters"],"created_at":"2025-08-29T11:44:03.715Z","updated_at":"2025-08-29T11:44:04.420Z","avatar_url":"https://github.com/janlelis.png","language":"JavaScript","funding_links":[],"categories":[],"sub_categories":[],"readme":"# unicode-category.js [![[ci]](https://github.com/janlelis/unicode-category.js/workflows/Test/badge.svg)](https://github.com/janlelis/unicode-category.js/actions?query=workflow%3ATest)\n\nReturns the [Major or General Category](https://en.wikipedia.org/wiki/Unicode_character_property#General_Category) a Unicode character belongs to.\n\nUnicode version: **16.0.0** (September 2024)\n\n## Install\n\nUse npm or your favorite package manager to install this module:\n\n```sh\nnpm install unicode-category\n```\n\nOr use ESM module directly from the browser.\n\n## Usage - General Category\n\n### `unicodeGeneralCategory(char)` / `unicodeGeneralCategoryLong(char)`\n\n```js\n// Get General Category of a single character\n\nimport { unicodeGeneralCategory, unicodeGeneralCategoryLong } from \"unicode-category\";\nunicodeGeneralCategory(\"ᴦ\") // 'Ll'\nunicodeGeneralCategoryLong(\"ᴦ\") // 'Lowercase_Letter'\nunicodeGeneralCategory(\"☼\") // 'So'\nunicodeGeneralCategoryLong(\"☼\") // 'Other_Symbol'\nunicodeGeneralCategory(\"𐱐\") // 'Cn'\nunicodeGeneralCategoryLong(\"𐱐\") // 'Unassigned'\n```\n\n### `unicodeGeneralCategories(string)` / `unicodeGeneralCategoriesLong(string)` \n\n```js\n// Get a Set of all General Categories used in a string\n\nimport { unicodeGeneralCategories, unicodeGeneralCategoriesLong } from \"unicode-category\";\nunicodeGeneralCategories(\"A 2\") // Set(3) { 'Lu', 'Nd', 'Zs' }\nunicodeGeneralCategoriesLong(\"A 2\") // Set(3) { \"Decimal_Number\", \"Space_Separator\", \"Uppercase_Letter\" }\n```\n\n## Usage - Major Category\n\n### `unicodeMajorCategory(char)` / `unicodeMajorCategoryLong(char)`\n\n```js\n// Get Major Category of a single character\n\nimport { unicodeMajorCategory, unicodeMajorCategoryLong } from \"unicode-category\";\nunicodeMajorCategory(\"ᴦ\") // 'L'\nunicodeMajorCategoryLong(\"ᴦ\") // 'Letter'\nunicodeMajorCategory(\"☼\") // 'S'\nunicodeMajorCategoryLong(\"☼\") // 'Symbol'\nunicodeMajorCategory(\"𐱐\") // 'C'\nunicodeMajorCategoryLong(\"𐱐\") // 'Other'\n```\n\n### `unicodeMajorCategories(string)` / `unicodeMajorCategoriesLong(string)` \n\n```js\nimport { unicodeMajorCategories, unicodeMajorCategoriesLong } from \"unicode-category\";\n\n// Set of all Major Categories of a string\nunicodeMajorCategories(\"A 2\") // Set(3) { 'L', 'N', 'Z' }\nunicodeMajorCategoriesLong(\"A 2\") // Set(3) { \"Number\", \"Separator\", \"Letter\" }\n```\n\n### List All Categories\n\n```js\nimport { listUnicodeGeneralCategories } from \"unicode-category\"\nlistUnicodeGeneralCategories()\n// {\n//   Cc: 'Control',\n//   Cf: 'Format',\n//   Cn: 'Unassigned',\n//   Co: 'Private_Use',\n//   Cs: 'Surrogate',\n//   LC: 'Cased_Letter',\n//   Ll: 'Lowercase_Letter',\n//   Lm: 'Modifier_Letter',\n//   Lo: 'Other_Letter',\n//   Lt: 'Titlecase_Letter',\n//   Lu: 'Uppercase_Letter',\n//   Mc: 'Spacing_Mark',\n//   Me: 'Enclosing_Mark',\n//   Mn: 'Nonspacing_Mark',\n//   Nd: 'Decimal_Number',\n//   Nl: 'Letter_Number',\n//   No: 'Other_Number',\n//   Pc: 'Connector_Punctuation',\n//   Pd: 'Dash_Punctuation',\n//   Pe: 'Close_Punctuation',\n//   Pf: 'Final_Punctuation',\n//   Pi: 'Initial_Punctuation',\n//   Po: 'Other_Punctuation',\n//   Ps: 'Open_Punctuation',\n//   Sc: 'Currency_Symbol',\n//   Sk: 'Modifier_Symbol',\n//   Sm: 'Math_Symbol',\n//   So: 'Other_Symbol',\n//   Zl: 'Line_Separator',\n//   Zp: 'Paragraph_Separator',\n//   Zs: 'Space_Separator'\n// }\n\nimport { listUnicodeMajorCategories } from \"unicode-category\"\nlistUnicodeMajorCategories()\n// {\n//   C: 'Other',\n//   L: 'Letter',\n//   M: 'Mark',\n//   N: 'Number',\n//   P: 'Punctuation',\n//   S: 'Symbol',\n//   Z: 'Separator'\n// }\n\n```\n\n## Also See\n\n- Get the script of a string: [unicode-script.js](https://github.com/janlelis/unicode-script.js)\n- Get the block of a string: [unicode-block.js](https://github.com/janlelis/unicode-block.js)\n- Get the name of a character: [unicode-name.js](https://github.com/janlelis/unicode-name.js)\n- Index created with: [unicoder](https://github.com/janlelis/unicoder)\n\n## MIT License\n\n- Copyright (C) 2024 Jan Lelis \u003chttps://janlelis.com\u003e. Released under the MIT license.\n- Unicode data: https://www.unicode.org/copyright.html#Exhibit1\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fjanlelis%2Funicode-category.js","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fjanlelis%2Funicode-category.js","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fjanlelis%2Funicode-category.js/lists"}