Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
https://github.com/foliojs/unicode-properties
Provides fast access to unicode character properties
https://github.com/foliojs/unicode-properties
Last synced: about 1 month ago
JSON representation
Provides fast access to unicode character properties
- Host: GitHub
- URL: https://github.com/foliojs/unicode-properties
- Owner: foliojs
- License: mit
- Created: 2015-04-04T02:14:51.000Z (over 9 years ago)
- Default Branch: master
- Last Pushed: 2023-01-08T21:51:57.000Z (almost 2 years ago)
- Last Synced: 2024-10-31T17:45:45.792Z (about 1 month ago)
- Language: JavaScript
- Size: 159 KB
- Stars: 53
- Watchers: 7
- Forks: 23
- Open Issues: 7
-
Metadata Files:
- Readme: readme.md
- License: LICENSE
Awesome Lists containing this project
- awesome-typography - unicode-properties - Provides fast access to unicode character properties. (JavaScript)
README
# unicode-properties
Provides fast access to unicode character properties. Uses [unicode-trie](https://github.com/devongovett/unicode-trie) to compress the
properties for all code points into just 9.5KB. Currently, unicode-properties supports Unicode version 12.## Usage
npm install unicode-properties
```javascript
var unicode = require('unicode-properties');unicode.getCategory('2'.charCodeAt()) //=> 'Nd'
unicode.getNumericValue('2'.charCodeAt()) //=> 2
```## API
### getCategory(codePoint)
Returns the unicode [general category](http://www.fileformat.info/info/unicode/category/index.htm) for the given code point.
### getScript(codePoint)
Returns the [script](http://unicode.org/standard/supported.html) for the given code point.
### getCombiningClass(codePoint)
Returns the [canonical combining class](http://unicode.org/glossary/#combining_class) for the given code point.
### getEastAsianWidth(codePoint)
Returns the [East Asian width](http://www.unicode.org/reports/tr11/tr11-28.html) for the given code point.
### getNumericValue(codePoint)
Returns the numeric value for the given code point, or null if there is no numeric value for that code point.
### isAlphabetic(codePoint)
Returns whether the code point is an alphabetic character.
### isDigit(codePoint)
Returns whether the code point is a digit.
### isPunctuation(codePoint)
Returns whether the code point is a punctuation character.
### isLowerCase(codePoint)
Returns whether the code point is lower case.
### isUpperCase(codePoint)
Returns whether the code point is upper case.
### isTitleCase(codePoint)
Returns whether the code point is title case.
### isWhiteSpace(codePoint)
Returns whether the code point is whitespace: specifically, whether the category is one of Zs, Zl, or Zp.
### isBaseForm(codePoint)
Returns whether the code point is a base form. A code point of base form does not graphically combine with preceding
characters.### isMark(codePoint)
Returns whether the code point is a mark character (e.g. accent).
## License
MIT