https://github.com/6km/arabic
A tiny library for dealing with Arabic text.
https://github.com/6km/arabic
arabic arabic-numbers digits library utils utils-library
Last synced: 3 months ago
JSON representation
A tiny library for dealing with Arabic text.
- Host: GitHub
- URL: https://github.com/6km/arabic
- Owner: 6km
- License: mit
- Created: 2025-03-28T17:10:08.000Z (about 1 year ago)
- Default Branch: main
- Last Pushed: 2025-03-29T02:51:19.000Z (about 1 year ago)
- Last Synced: 2025-06-04T18:51:22.949Z (12 months ago)
- Topics: arabic, arabic-numbers, digits, library, utils, utils-library
- Language: TypeScript
- Homepage:
- Size: 15.6 KB
- Stars: 2
- Watchers: 1
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
- License: LICENSE
Awesome Lists containing this project
README
# arabic
A tiny library for dealing with Arabic text.
# Installation
```sh
# npm
npm install arabic
# yarn
yarn add arabic
# pnpm
pnpm add arabic
```
# Usage example
```js
import {
remove_harakat,
to_western_digits,
to_eastern_digits,
} from './arabic-utils'
// Example: Remove Harakat
const text = 'أَحْمَدُ'
const text_without_harakat = remove_harakat(text)
console.log(text_without_harakat) // Output: أحمد
// Example: Convert Eastern Arabic digits to Western Arabic digits
const eastern_digits_string = '١٢٣٤٥'
const western_digits_string = to_western_digits(eastern_digits_string)
console.log(western_digits_string) // Output: 12345
// Example: Convert Western Arabic digits to Eastern Arabic digits
const western_digits_string = '12345'
const eastern_digits_string = to_eastern_digits(western_digits_string)
console.log(eastern_digits_string) // Output: ١٢٣٤٥
```
# License
This library is licensed under the MIT license.