arabicStrings
An NPM package that extends the native String object with methods to help when dealing with Arabic strings for node and the browser.
NPM updated package of @ahmads/arabicString repo
Usage
node
require('arabicString')
##String#howArabic()
The percentage of Arabic letters in the String
.
Example
'foobar'.howArabic()
'فوو bar'.howArabic()
'فوبار'.howArabic()
##String#howNotArabic()
The percentage of non-Arabic letters in the String
.
Example
'فوبار'.howNotArabic()
'فوو bar'.howNotArabic()
'foobar'.howNotArabic()
String#isArabic(threshold)
Is the String
Arabic, based on a given threshold
between 0
and 1
. Defaults to 0.79
.
Example
'فوو'.isArabic()
'فوو bar baz'.isArabic(0.5)
String#hasArabic()
Does the String
have any Arabic letter.
Example
'فوو bar'.hasArabic()
'foo bar'.hasArabic()
String#removeTashkel()
Will return the String
without the diacritics.
Example
'مٌحمْد'.removeTashkel()
'وَتُرى الْكَوَاكِبِ فِي الْمَجَرَّةِ شَرَعَا*** مِثْلُ الظِّباءِ كوارعا فِي جَدْوَلِ'.removeTashkel()
##String#removeTatwel()
Will return the String
without the diacritics.
Example
'مــرحــبــا'.removeTatwel()
Credits
License
(The MIT License)