
Product
Rust Support Now in Beta
Socket's Rust support is moving to Beta: all users can scan Cargo projects and generate SBOMs, including Cargo.toml-only crates, with Rust-aware supply chain checks.
general-category
Advanced tools
Look up General_Category of Unicode character with JavaScript.
$ du -h `npm pack general-category@1.3`
184K general-category-1.3.0.tgz
$ du -h `npm pack general-category@1.4`
24K general-category-1.4.0.tgz
$ du -h `npm pack general-category@1.5`
17K general-category-1.5.0.tgz
const category = require('general-category');
// Just gimme character and you'll get category.
category('Å'); //=> 'Lu'
// This module is aware of surrogate pairs.
category('\u{1F600}'); //=> 'So'
// Providing code point also works.
category(0x0020); //=> 'Zs'
// You'll get category data with latest version of Unicode by default.
// You can switch it by `version` option
category('\u{1F600}', {version: '6.0.0'}); //=> 'Cn'
// If you are only interested in the specific version of Unicode,
// you can require the module with limited data loaded.
const category3_2_0 = require('general-category/3.2.0');
category3_2_0('\u{1F600}'); //=> 'Cn'
// 'latest' version also works.
const categoryLatest = require('general-category/latest');
categoryLatest('\u{1F600}'); //=> 'So'
// You can get long_name instead of an abbreviated one.
category('Ä', {long: true}); //=> 'Uppercase_Letter'
// You can also get detaild information of category.
category('Ä', {detailed: true}); //=> { large: 'L', small: 'Lu' }
This module exposes single function category(character[, options])
.
character
[String | Number]: Character or code point to look up for General_Categoryoptions
[Object]:
long
[Boolean]: Returns long_name instead of abbreviated form. Default is false
.detailed
[Boolean]: Returns detailed category information instead of plain string. Default is false
.version
[String | Null]: Version number to use as unicode data source. You can set null
to use latest version included. These versions are derived from node-unicode-data and currently all available versions are:
options.detailed
is set true
, returns object with detailed category information.FAQs
Look up General_Category of Unicode character
We found that general-category demonstrated a not healthy version release cadence and project activity because the last version was released a year ago. It has 1 open source maintainer collaborating on the project.
Did you know?
Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.
Product
Socket's Rust support is moving to Beta: all users can scan Cargo projects and generate SBOMs, including Cargo.toml-only crates, with Rust-aware supply chain checks.
Product
Socket Fix 2.0 brings targeted CVE remediation, smarter upgrade planning, and broader ecosystem support to help developers get to zero alerts.
Security News
Socket CEO Feross Aboukhadijeh joins Risky Business Weekly to unpack recent npm phishing attacks, their limited impact, and the risks if attackers get smarter.