Socket
Socket
Sign inDemoInstall

regenerate-unicode-properties

Package Overview
Dependencies
1
Maintainers
2
Versions
31
Alerts
File Explorer

Advanced tools

Install Socket

Detect and block malicious and high-risk dependencies

Install

regenerate-unicode-properties

Regenerate sets for Unicode properties and values.


Version published
Maintainers
2
Weekly downloads
21,403,481
increased by4.02%
Bundle size
1.8 kB
Minified + gzipped

Weekly downloads

Package description

What is regenerate-unicode-properties?

The regenerate-unicode-properties package is a tool for generating JavaScript regular expressions based on Unicode properties. It is used to create sets of Unicode symbols that match certain criteria, such as belonging to a particular category, script, or block. This can be useful for text processing tasks that require matching characters with specific Unicode attributes.

What are regenerate-unicode-properties's main functionalities?

Generating regex sets for Unicode categories

This feature allows you to generate regular expressions that match any character from a specific Unicode category, such as letters (category 'L').

const regenerate = require('regenerate-unicode-properties');
const regex = regenerate().addCategory('L').toRegExp();
// regex will match any Unicode letter

Generating regex sets for Unicode scripts

This feature enables the creation of regular expressions that match characters from a specific Unicode script, such as Hiragana.

const regenerate = require('regenerate-unicode-properties');
const regex = regenerate().addScript('Hiragana').toRegExp();
// regex will match any character in the Hiragana script

Generating regex sets for Unicode blocks

With this feature, you can generate regular expressions that match characters within a specific Unicode block, like the Basic Latin block.

const regenerate = require('regenerate-unicode-properties');
const regex = regenerate().addBlock('Basic_Latin').toRegExp();
// regex will match any character in the Basic Latin block

Other packages similar to regenerate-unicode-properties

Readme

Source

regenerate-unicode-properties regenerate-unicode-properties on npm

regenerate-unicode-properties is a collection of Regenerate sets for various Unicode properties.

Installation

To use regenerate-unicode-properties programmatically, install it as a dependency via npm:

$ npm install regenerate-unicode-properties

Usage

To get a map of supported properties and their values:

const properties = require('regenerate-unicode-properties');

To get a specific Regenerate set:

// Examples:
const Lu = require('regenerate-unicode-properties/General_Category/Uppercase_Letter.js').characters;
const Greek = require('regenerate-unicode-properties/Script_Extensions/Greek.js').characters;

Some properties can also refer to strings rather than single characters:

const { characters, strings } = require('regenerate-unicode-properties/Property_of_Strings/Basic_Emoji.js');

To get the Unicode version the data was based on:

const unicodeVersion = require('regenerate-unicode-properties/unicode-version.js');

For maintainers

How to publish a new release

  1. On the main branch, bump the version number in package.json:

    npm version patch -m 'Release v%s'
    

    Instead of patch, use minor or major as needed.

    Note that this produces a Git commit + tag.

  2. Push the release commit and tag:

    git push && git push --tags
    

    Our CI then automatically publishes the new release to npm.

Author

twitter/mathias
Mathias Bynens

License

regenerate-unicode-properties is available under the MIT license.

Keywords

FAQs

Last updated on 15 Sep 2023

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.

Install

Related posts

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc