Huge News!Announcing our $40M Series B led by Abstract Ventures.Learn More
Socket
Sign inDemoInstall
Socket

@6degrees/arabic-strings

Package Overview
Dependencies
Maintainers
1
Versions
9
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

@6degrees/arabic-strings - npm Package Compare versions

Comparing version 0.1.1 to 0.2.0

6

CHANGELOG.md
# @6degrees/arabic-strings
## 0.2.0
### Minor Changes
- enhanced removeNonArabic to accept excluded characters
## 0.1.1

@@ -4,0 +10,0 @@

8

dist/index.js

@@ -27,4 +27,5 @@ "use strict";

}
static removeNonArabic(str) {
return str.replace(/[^\u0621-\u0652]/gm, "");
static removeNonArabic(str, excludeChars = "") {
const exclusionRegex = new RegExp(`[${excludeChars}]`, "gm");
return str.replace(new RegExp(`[^\\u0621-\\u0652${excludeChars}]`, "gm"), "").replace(exclusionRegex, "");
}

@@ -110,5 +111,4 @@ static removeArabic(str) {

arabicStrings.TA = /[ة]/g;
arabicStrings.TASHKEEL_REGEX = new RegExp("[" + _arabicStrings.TASHKEEL.join() + "]", "g");
// /[\u064B-\u0652]
arabicStrings.TASHKEEL_REGEX = new RegExp(_arabicStrings.TASHKEEL.join(""), "g");
arabicStrings.TATWEEL_REGEX = /ـ/g;
module.exports = arabicStrings;
{
"name": "@6degrees/arabic-strings",
"license": "MIT",
"version": "0.1.1",
"version": "0.2.0",
"main": "dist/index.js",

@@ -6,0 +6,0 @@ "module": "dist/index.mjs",

@@ -37,3 +37,4 @@ class arabicStrings {

static TA = /[ة]/g;
static TASHKEEL_REGEX = new RegExp("[" + arabicStrings.TASHKEEL.join() + "]", 'g'); // /[\u064B-\u0652]
static TASHKEEL_REGEX = new RegExp(arabicStrings.TASHKEEL.join(""), "g");
static TATWEEL_REGEX = /ـ/g; // /\u0640/g

@@ -73,5 +74,7 @@

static removeNonArabic(str: string): string {
return str.replace(/[^\u0621-\u0652]/gm, "");
}
static removeNonArabic(str: string, excludeChars: string = ""): string {
const exclusionRegex = new RegExp(`[${excludeChars}]`, "gm");
return str.replace(new RegExp(`[^\\u0621-\\u0652${excludeChars}]`, "gm"), "").replace(exclusionRegex, "");
}

@@ -78,0 +81,0 @@ static removeArabic(str: string): string {

Sorry, the diff of this file is not supported yet

SocketSocket SOC 2 Logo

Product

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

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc