What is unicode-property-aliases-ecmascript?
The unicode-property-aliases-ecmascript npm package provides a mapping of Unicode property alias names to their canonical property names as per the ECMAScript specification. This is useful for developers working with Unicode properties in regular expressions and other text processing tasks.
What are unicode-property-aliases-ecmascript's main functionalities?
Mapping Unicode Property Aliases
This feature allows you to map a Unicode property alias to its canonical property name. For example, the alias 'scx' maps to 'Script_Extensions'.
const unicodePropertyAliases = require('unicode-property-aliases-ecmascript');
console.log(unicodePropertyAliases.get('scx')); // Outputs: 'Script_Extensions'
Iterating Over All Aliases
This feature allows you to iterate over all the alias-canonical name pairs in the mapping. This can be useful for debugging or for generating documentation.
const unicodePropertyAliases = require('unicode-property-aliases-ecmascript');
for (const [alias, canonical] of unicodePropertyAliases) {
console.log(`${alias} -> ${canonical}`);
}
Other packages similar to unicode-property-aliases-ecmascript
unicode-canonical-property-names-ecmascript
This package provides a mapping of canonical Unicode property names to their canonical values as per the ECMAScript specification. Unlike unicode-property-aliases-ecmascript, which focuses on alias to canonical name mapping, this package focuses on canonical name to value mapping.
unicode-match-property-ecmascript
This package provides a function to match Unicode property names and values as per the ECMAScript specification. It is more focused on matching properties in regular expressions, whereas unicode-property-aliases-ecmascript is focused on alias to canonical name mapping.
unicode-match-property-value-ecmascript
This package provides a function to match Unicode property values as per the ECMAScript specification. It complements unicode-match-property-ecmascript by focusing on property values, while unicode-property-aliases-ecmascript focuses on alias to canonical name mapping.
unicode-property-aliases-ecmascript
unicode-property-aliases-ecmascript offers Unicode property alias mappings in an easy-to-consume JavaScript format. It only contains the Unicode property names that are supported in ECMAScript RegExp property escapes.
It’s based on the PropertyAliases.txt
data for Unicode v12.0.0.
Installation
To use unicode-property-aliases-ecmascript programmatically, install it as a dependency via npm:
$ npm install unicode-property-aliases-ecmascript
Then, require
it:
const propertyAliases = require('unicode-property-aliases-ecmascript');
Usage
This module exports a Map
object. The most common usage is to convert a property alias to its canonical form:
propertyAliases.get('scx')
Author
License
unicode-property-aliases-ecmascript is available under the MIT license.