@imranbarbhuiya/decancer
Advanced tools
Comparing version 0.1.1-next.be1d0c3.0 to 0.1.1
# Changelog | ||
All notable changes to this project will be documented in this file. | ||
# [0.1.1](https://github.com/imranbarbhuiya/decancer/compare/v0.1.0...v0.1.1) - (2022-05-30) | ||
## π Refactor | ||
- Simplify cancerous check (#4) ([60b77c1](https://github.com/imranbarbhuiya/decancer/commit/60b77c1d4940d5d43c651c6fe7be9d4a4e5d04f9)) | ||
### π₯ Breaking Changes: | ||
# [0.1.0] | ||
@@ -5,0 +14,0 @@ (https://github.com/imranbarbhuiya/decancer/tree/v0.1.0) - (2022-05-30) |
@@ -1,4 +0,1 @@ | ||
declare const isAscii: (str: string) => boolean; | ||
declare const isAlnum: (char: string) => boolean; | ||
declare const decancer: (str: string) => string; | ||
@@ -8,2 +5,2 @@ | ||
export { decancer, isAlnum, isAscii, isCancerous }; | ||
export { decancer, isCancerous }; |
@@ -28,4 +28,2 @@ "use strict"; | ||
decancer: () => decancer, | ||
isAlnum: () => isAlnum, | ||
isAscii: () => isAscii, | ||
isCancerous: () => isCancerous | ||
@@ -35,6 +33,2 @@ }); | ||
// src/lib/utils/index.ts | ||
var isAscii = /* @__PURE__ */ __name((str) => /^[\x00-\x7F]*$/.test(str), "isAscii"); | ||
var isAlnum = /* @__PURE__ */ __name((char) => /^[a-zA-Z0-9]$/.test(char), "isAlnum"); | ||
// src/lib/decancer.ts | ||
@@ -52,10 +46,3 @@ var import_unidecode = __toESM(require("unidecode")); | ||
var isCancerous = /* @__PURE__ */ __name((str) => { | ||
for (const segment of str.split(/\s+/)) { | ||
for (const char of segment) { | ||
if (!(isAscii(char) && isAlnum(char))) { | ||
return true; | ||
} | ||
} | ||
} | ||
return false; | ||
return /[^\p{ASCII}]/u.test(str); | ||
}, "isCancerous"); | ||
@@ -65,6 +52,4 @@ // Annotate the CommonJS export names for ESM import in node: | ||
decancer, | ||
isAlnum, | ||
isAscii, | ||
isCancerous | ||
}); | ||
//# sourceMappingURL=index.js.map |
{ | ||
"name": "@imranbarbhuiya/decancer", | ||
"version": "0.1.1-next.be1d0c3.0", | ||
"description": "A package to remove zalgo and common confusables from strings.", | ||
"version": "0.1.1", | ||
"description": "A package to remove zalgo and common confusable characters from strings.", | ||
"main": "dist/index.js", | ||
@@ -39,2 +39,5 @@ "module": "dist/index.mjs", | ||
}, | ||
"dependencies": { | ||
"unidecode": "^0.1.8" | ||
}, | ||
"devDependencies": { | ||
@@ -97,6 +100,3 @@ "@commitlint/cli": "^17.0.1", | ||
"packageManager": "yarn@3.2.1", | ||
"prettier": "@sapphire/prettier-config", | ||
"dependencies": { | ||
"unidecode": "^0.1.8" | ||
} | ||
"prettier": "@sapphire/prettier-config" | ||
} |
@@ -13,3 +13,3 @@ <div align="center"> | ||
A package to remove zalgo and common confusables from strings. | ||
A package to remove zalgo and common confusable characters from strings. | ||
@@ -33,3 +33,2 @@ Read Full Documentation [here](https://imranbarbhuiya.github.io/decancer). | ||
npm i @imranbarbhuiya/decancer | ||
``` | ||
@@ -40,5 +39,11 @@ | ||
```ts | ||
import { decancer } from '@imranbarbhuiya/decancer'; | ||
import { decancer, isCancerous } from '@imranbarbhuiya/decancer'; | ||
const result = decancer('Hello World'); | ||
// Check if a string is cancerous | ||
isCancerous('hello world'); // false | ||
isCancerous('vοΌ₯β‘π π½πΕβο½ Ε£δΉππ£'); // true | ||
// Decancer a string | ||
const result = decancer('HΠ£PΞΠ―_XD'); | ||
``` | ||
@@ -45,0 +50,0 @@ |
Sorry, the diff of this file is too big to display
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Deprecated
MaintenanceThe maintainer of the package marked it as deprecated. This could indicate that a single version should not be used, or that the package is no longer maintained and any new vulnerabilities will not be fixed.
Found 1 instance in 1 package
0
75
1091022
2875