Skip to content

Commit

Permalink
1.1.6
Browse files Browse the repository at this point in the history
  • Loading branch information
null8626 committed Mar 18, 2022
1 parent af361db commit 9f7f259
Show file tree
Hide file tree
Showing 15 changed files with 49 additions and 33 deletions.
48 changes: 32 additions & 16 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,26 +1,35 @@
# decancer
A Node.js module that removes common confusables from strings written in pure [Rust](https://rust-lang.org) without the use of Regexes.
A Node.js module that removes common confusables from strings written in pure [Rust](https://rust-lang.org).

__**As of version 1.1.5, This library supports 2,487 different code-points.**__
- Extremely fast, no use of regex whatsoever!
- No dependencies.
- Simple to use, just one single function.
- Supports UTF-8 for basic confusables.
- Supports UTF-16 for the majority of confusables, this includes zalgos, foreign languages, etc.
- Supports UTF-32 for emojis and 'fancy fonts'.
- While this project may not be perfect, it should cover the vast majority of confusables.

__**As of version 1.1.6, This library supports 2,486 different UTF-16 code-points.**__

# installation
Install with npm:
Install cross-platform release with npm: (Highly recommended)
```bash
$ npm install decancer
```

Supported platforms:
- Windows x64
- Windows arm64
- Windows i686
- macOS x64
- macOS arm64
- Linux x64 GNU
- Linux x64 MUSL
- Linux arm64 GNU
- Linux arm64 MUSL
- Linux arm gnueabihf
- Android arm64
Or if you're targeting a specific platform, You can use these links to go to each platform-specific release.

- [Windows x64](https://www.npmjs.com/package/@vierofernando/decancer-win32-x64-msvc)
- [Windows arm64](https://www.npmjs.com/package/@vierofernando/decancer-win32-arm64-msvc)
- [Windows i686](https://www.npmjs.com/package/@vierofernando/decancer-win32-ia32-msvc)
- [macOS x64](https://www.npmjs.com/package/@vierofernando/decancer-darwin-x64)
- [macOS arm64](https://www.npmjs.com/package/@vierofernando/decancer-darwin-arm64)
- [Linux x64 GNU](https://www.npmjs.com/package/@vierofernando/decancer-linux-x64-gnu)
- [Linux x64 MUSL](https://www.npmjs.com/package/@vierofernando/decancer-linux-x64-musl)
- [Linux arm64 GNU](https://www.npmjs.com/package/@vierofernando/decancer-linux-arm64-gnu)
- [Linux arm64 MUSL](https://www.npmjs.com/package/@vierofernando/decancer-linux-arm64-musl)
- [Linux arm gnueabihf](https://www.npmjs.com/package/@vierofernando/decancer-linux-arm-gnueabihf)
- [Android arm64](https://www.npmjs.com/package/@vierofernando/decancer-android-arm64)

# example
```js
Expand All @@ -32,4 +41,11 @@ console.log(noCancer); // 'very funny text'
> **NOTE:** output will ALWAYS be in lowercase and invalid UTF-16 code-points will be replaced by a replacement character (\uFFFD or �).
# contributions
All contributions are welcome. If you want to, you can [make a fork here at GitHub.](https://github.com/vierofernando/decancer/fork) Thanks! <3
All contributions are welcome. If you want to, you can [make a fork here at GitHub.](https://github.com/vierofernando/decancer/fork) Thanks! <3

# special thanks
These are the primary resources that made this project possible.

- [The Official Unicode Confusables List](https://util.unicode.org/UnicodeJsps/confusables.jsp)
- [Fancy Text Generator](https://lingojam.com/FancyTextGenerator)
- [Unicode character inspector](https://apps.timwhitlock.info/unicode/inspect)
2 changes: 1 addition & 1 deletion npm/android-arm64/package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "@vierofernando/decancer-android-arm64",
"version": "1.1.5",
"version": "1.1.6",
"os": [
"android"
],
Expand Down
2 changes: 1 addition & 1 deletion npm/darwin-arm64/package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "@vierofernando/decancer-darwin-arm64",
"version": "1.1.5",
"version": "1.1.6",
"os": [
"darwin"
],
Expand Down
2 changes: 1 addition & 1 deletion npm/darwin-x64/package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "@vierofernando/decancer-darwin-x64",
"version": "1.1.5",
"version": "1.1.6",
"os": [
"darwin"
],
Expand Down
2 changes: 1 addition & 1 deletion npm/linux-arm-gnueabihf/package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "@vierofernando/decancer-linux-arm-gnueabihf",
"version": "1.1.5",
"version": "1.1.6",
"os": [
"linux"
],
Expand Down
2 changes: 1 addition & 1 deletion npm/linux-arm64-gnu/package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "@vierofernando/decancer-linux-arm64-gnu",
"version": "1.1.5",
"version": "1.1.6",
"os": [
"linux"
],
Expand Down
2 changes: 1 addition & 1 deletion npm/linux-arm64-musl/package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "@vierofernando/decancer-linux-arm64-musl",
"version": "1.1.5",
"version": "1.1.6",
"os": [
"linux"
],
Expand Down
2 changes: 1 addition & 1 deletion npm/linux-x64-gnu/package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "@vierofernando/decancer-linux-x64-gnu",
"version": "1.1.5",
"version": "1.1.6",
"os": [
"linux"
],
Expand Down
2 changes: 1 addition & 1 deletion npm/linux-x64-musl/package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "@vierofernando/decancer-linux-x64-musl",
"version": "1.1.5",
"version": "1.1.6",
"os": [
"linux"
],
Expand Down
2 changes: 1 addition & 1 deletion npm/win32-arm64-msvc/package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "@vierofernando/decancer-win32-arm64-msvc",
"version": "1.1.5",
"version": "1.1.6",
"os": [
"win32"
],
Expand Down
2 changes: 1 addition & 1 deletion npm/win32-ia32-msvc/package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "@vierofernando/decancer-win32-ia32-msvc",
"version": "1.1.5",
"version": "1.1.6",
"os": [
"win32"
],
Expand Down
2 changes: 1 addition & 1 deletion npm/win32-x64-msvc/package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "@vierofernando/decancer-win32-x64-msvc",
"version": "1.1.5",
"version": "1.1.6",
"os": [
"win32"
],
Expand Down
4 changes: 2 additions & 2 deletions package.json
Original file line number Diff line number Diff line change
@@ -1,13 +1,13 @@
{
"name": "decancer",
"version": "1.1.5",
"version": "1.1.6",
"main": "./main.js",
"description": "A Node.js module that removes common confusables from strings written in pure Rust without the use of Regexes.",
"keywords": [
"string",
"unicode",
"zalgo",
"regexp",
"rust",
"confusables",
"moderation"
],
Expand Down
6 changes: 3 additions & 3 deletions prepare.js
Original file line number Diff line number Diff line change
Expand Up @@ -5,10 +5,10 @@ const { join } = require("path");
const alphabetRs = readFileSync(join(__dirname, "src", "alphabet.rs")).toString();
const miscRs = readFileSync(join(__dirname, "src", "misc.rs")).toString();

const ALPHABETICAL_1 = eval(alphabetRs.match(/const ALPHABETICAL_1: \[&'static \[u16\]; 26\] = ([\s\S]*?);/)[1].replace(/&\[/g, "[")).flat();
const ALPHABETICAL_1 = eval(alphabetRs.match(/const ALPHABETICAL_1: \[&'static \[u16\]; \d+\] = ([\s\S]*?);/)[1].replace(/&\[/g, "[")).flat();

const ALPHABETICAL_2_ORDERS = eval(alphabetRs
.match(/const ALPHABETICAL_2_ORDERS: \[\(u16, &'static \[u16\]\); 2\] = ([\s\S]*?);/)[1]
.match(/const ALPHABETICAL_2_ORDERS: \[\(u16, &'static \[u16\]\); \d+\] = ([\s\S]*?);/)[1]
.match(/&\[([\s\S]*?)\]/g)
.map(x => x.slice(1))).flat().length * 24;

Expand Down Expand Up @@ -47,7 +47,7 @@ const supportedCount =

writeFileSync("README.md", readFileSync("./README.md").toString()
.replace(/__\*\*([\s\S]*?)\*\*__/,
`__**As of version ${version}, This library supports ${supportedCount.toLocaleString()} different code-points.**__`));
`__**As of version ${version}, This library supports ${supportedCount.toLocaleString()} different UTF-16 code-points.**__`));

for (const platform of readdirSync("./npm")) {
const packageJsonPath = join(__dirname, "npm", platform, "package.json");
Expand Down
2 changes: 1 addition & 1 deletion src/alphabet.rs
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ const ALPHABETICAL_1: [&'static [u16]; 26] = [
&[0x00DF, 0x0180, 0x0183, 0x0185, 0x0253, 0x0284, 0x0299, 0x03B2, 0x0431, 0x0432, 0x044A, 0x044C, 0x0463, 0x048D, 0x0495, 0x0E3F, 0x13FC, 0x1472, 0x15AF, 0x15F7, 0x1D03, 0x1D2E, 0x1D2F, 0x1D47, 0x1D5D, 0x1D66, 0x1D6C, 0x212C, 0x4E43, 0x65E5, 0xA4D0, 0xA7B5, 0xAB9F, 0xDC35, 0xDC4F, 0xDC69, 0xDC83, 0xDDA1, 0xDDBB, 0xDEA9, 0xDEE3, 0xDF01, 0xDF1D, 0xDF57, 0xDF91],
&[0x00A2, 0x00A9, 0x00E7, 0x0107, 0x0109, 0x010B, 0x010D, 0x0188, 0x023C, 0x0254, 0x0255, 0x0297, 0x037B, 0x037C, 0x037D, 0x0441, 0x0481, 0x04AB, 0x1103, 0x1455, 0x1D04, 0x1D9C, 0x20B5, 0x2102, 0x2103, 0x212D, 0x217D, 0x2CA5, 0x4EA1, 0x531A, 0xA4DA, 0xABAF, 0xDC36, 0xDC50, 0xDC6A, 0xDC84, 0xDDA2, 0xDDBC, 0xDF4C, 0xFFE0],
&[0x0111, 0x018C, 0x0501, 0x146F, 0x15DE, 0x15EA, 0x1D05, 0x1D06, 0x1D30, 0x1D48, 0x1D5F, 0x1D6D, 0x2145, 0x2146, 0x217E, 0x53E5, 0xA4D2, 0xA4D3, 0xAB70, 0xABB7, 0xDC37, 0xDC51, 0xDC6B, 0xDC85, 0xDDA3, 0xDDBD],
&[0x00A3, 0x00E8, 0x00E9, 0x00EA, 0x00EB, 0x0113, 0x0115, 0x0117, 0x0119, 0x011B, 0x01B9, 0x01DD, 0x0205, 0x0207, 0x021D, 0x0221, 0x0229, 0x0247, 0x0256, 0x0257, 0x0283, 0x03AD, 0x03B5, 0x03BE, 0x03F1, 0x03F2, 0x03F5, 0x03F6, 0x0435, 0x0450, 0x0451, 0x0454, 0x0465, 0x04BD, 0x04BF, 0x04D7, 0x04D9, 0x04DB, 0x15F4, 0x1D07, 0x1D31, 0x1D49, 0x1D4B, 0x2091, 0x2094, 0x20AC, 0x2107, 0x2108, 0x212E, 0x212F, 0x2130, 0x2140, 0x2147, 0x22FF, 0x2D39, 0x30E8, 0x4E47, 0xA4F0, 0xAB32, 0xAB7C, 0xDC38, 0xDC52, 0xDC6C, 0xDC86, 0xDDA4, 0xDDBE, 0xDEAC, 0xDEE6, 0xDF20, 0xDF5A, 0xDF94, 0xFFE1],
&[0x00A3, 0x00E8, 0x00E9, 0x00EA, 0x00EB, 0x0113, 0x0115, 0x0117, 0x0119, 0x011B, 0x01B9, 0x01DD, 0x0205, 0x0207, 0x021D, 0x0221, 0x0229, 0x0247, 0x0257, 0x0283, 0x03AD, 0x03B5, 0x03BE, 0x03F1, 0x03F2, 0x03F5, 0x03F6, 0x0435, 0x0450, 0x0451, 0x0454, 0x0465, 0x04BD, 0x04BF, 0x04D7, 0x04D9, 0x04DB, 0x15F4, 0x1D07, 0x1D31, 0x1D49, 0x1D4B, 0x2091, 0x2094, 0x20AC, 0x2107, 0x2108, 0x212E, 0x212F, 0x2130, 0x2140, 0x2147, 0x22FF, 0x2D39, 0x30E8, 0x4E47, 0xA4F0, 0xAB32, 0xAB7C, 0xDC38, 0xDC52, 0xDC6C, 0xDC86, 0xDDA4, 0xDDBE, 0xDEAC, 0xDEE6, 0xDF20, 0xDF5A, 0xDF94, 0xFFE1],
&[0x010F, 0x017F, 0x0192, 0x0258, 0x0259, 0x025A, 0x025B, 0x025C, 0x025D, 0x025E, 0x03DD, 0x0493, 0x04FB, 0x0584, 0x15B4, 0x1D6E, 0x1DA0, 0x1E9D, 0x20A3, 0x2109, 0x2131, 0x214E, 0x4E4D, 0x5343, 0xA4DD, 0xA730, 0xA799, 0xAB35, 0xDC39, 0xDC53, 0xDC6D, 0xDC87, 0xDDA5, 0xDDBF, 0xDEA5, 0xDFCA],
&[0x011D, 0x011F, 0x0121, 0x0123, 0x01E5, 0x01E7, 0x01F5, 0x0260, 0x0261, 0x0262, 0x0265, 0x0266, 0x0267, 0x029B, 0x050D, 0x0581, 0x13FB, 0x1D33, 0x1D4D, 0x1D77, 0x1D79, 0x1D83, 0x20B2, 0x210A, 0x5442, 0xA4D6, 0xAB86, 0xAB90, 0xDC3A, 0xDC54, 0xDC6E, 0xDC88, 0xDDA6, 0xDDC0],
&[0x0125, 0x0127, 0x0195, 0x021F, 0x029C, 0x02AE, 0x02AF, 0x02B0, 0x043D, 0x045B, 0x04A3, 0x04A5, 0x04BB, 0x04C8, 0x04CA, 0x0570, 0x157C, 0x1D34, 0x2095, 0x210B, 0x210C, 0x210D, 0x210E, 0x210F, 0x2C68, 0x2C8F, 0x5344, 0x5EFE, 0xA4E7, 0xAB8B, 0xAB92, 0xDC3B, 0xDC6F, 0xDC89, 0xDDA7, 0xDDC1, 0xDEAE, 0xDECF, 0xDEE8, 0xDF22, 0xDF5C, 0xDF96],
Expand Down

0 comments on commit 9f7f259

Please sign in to comment.