# persian-utilities

> Persian utilities using for persian application lang UTF8

Latest version **1.1.1** (published 2022-08-08) · MIT license · 0 weekly downloads

## Install

```sh
npm install persian-utilities
pnpm add persian-utilities
yarn add persian-utilities
bun add persian-utilities
```

## Health

**Score 15/100 (F)** — status: abandoned.

Positive: no vulnerabilities.

Warnings: low downloads; no types; no esm support.

Negative: abandoned; low maintenance score.

## Facts

| | |
|---|---|
| Version | 1.1.1 |
| Published | 2022-08-08 |
| First published | 2022-07-23 |
| Weekly downloads | 0 |
| License | MIT |
| TypeScript types | none |
| Module format | CommonJS |
| Dependencies | 3 |
| Unpacked size | 74.7 KB |
| Known vulnerabilities | 0 |
| Install scripts | no |
| GitHub stars | 26 |
| Author | itsreza |
| Maintainers | itsreza |
| Keywords | Persian, Utils, Language, English, UTF8, Convert, utilities, persian-utilities, wordify-numbers, wordify-persian-numbers, time-ago, credit-card, iranian-bank, persian tools |

## Links

- npm: https://www.npmjs.com/package/persian-utilities
- Repository: https://github.com/itsreza/persian-utilities
- Homepage: https://github.com/itsreza/persian-utils#readme
- Issues: https://github.com/itsreza/persian-utils/issues
- npm.io page: https://npm.io/package/persian-utilities

## Dependencies (3)

- [jest](https://npm.io/package/jest.md) ^26.5.3
- [ts-jest](https://npm.io/package/ts-jest.md) ^26.4.1
- [eslint-plugin-jest](https://npm.io/package/eslint-plugin-jest.md) ^24.1.0

## Alternatives

- [random-seedable](https://npm.io/package/random-seedable.md) — 27.9K weekly downloads
- [n2words](https://npm.io/package/n2words.md) — 22.2K weekly downloads
- [@stdlib/math-base-special-factorialln](https://npm.io/package/@stdlib/math-base-special-factorialln.md) — 5.7K weekly downloads
- [@stdlib/math-base-special-abs2](https://npm.io/package/@stdlib/math-base-special-abs2.md) — 1.7K weekly downloads
- [commons-math-interpolation](https://npm.io/package/commons-math-interpolation.md) — 1.4K weekly downloads

## Recent versions

- 1.1.1 (latest) — 2022-08-08
- 1.1.0 — 2022-08-06
- 1.0.3 — 2022-07-31
- 1.0.2 — 2022-07-28
- 1.0.1 — 2022-07-23
- 1.0.0 — 2022-07-23

## README

# persian-utilities

![alt text](typo.png)

[![License: MIT](https://img.shields.io/badge/License-MIT-green.svg)](https://opensource.org/licenses/MIT)

Persian Modules need to Improved Application.</br>
Collections of Persian Utils And Helpers Function.

## Collections

-   [**convertDigitsFaToEn**](#convertdigitsfatoen)
-   [**convertDigitsEnToFa**](#convertdigitsentofa)
-   [**persianCardValidation**](#persiancardvalidation)
-   [**timeAgo**](#timeago)
-   [**isNationalID**](#isnationalid)
-   [**numericalSeparator**](#numericalseparator)
-   [**numericalWithoutSeparator**](#numericalwithoutseparator)
-   [**wordifyNumbers**](#wordifynumbers)
-   [**abbNumber**](#abbnumber)

## Install

### NPM

```
npm install persian-utilities
```

## Usage

Import `persian-utilities` into your app's modules or import ES modules With Name

## Apis

### convertDigitsFaToEn

```javascript
import { convertDigitsFaToEn } from 'persian-utilities';
convertDigitsFaToEn('۱۲۳۴'); // result : 1234
```

### convertDigitsEnToFa

```javascript
import { convertDigitsEnToFa } from 'persian-utilities';
convertDigitsEnToFa('1234'); // result : ۱۲۳۴
```

### persianCardValidation

```javascript
import { persianCardValidation } from 'persian-utilities';
persianCardValidation('6219861054512345'); // result : {bankName : "بانک سامان" , isValid : true}
```

### timeAgo

second argument set Exact option

```javascript
import { timeAgo } from 'persian-utilities';
// not exact mode
timeAgo('۱۴۰۱/۰۵/۰۹ ۱۰:۰۰'); // result : روز قبل 1
// exact mode
timeAgo('۱۴۰۱/۰۵/۰۹ ۱۰:۰۰', true); // result : ثانیه29 و ساعت2 و روز1
```

### isNationalID

```javascript
import { isNationalID } from 'persian-utilities';
isNationalID('1111111111'); // result : true
```

### numericalSeparator

```javascript
import { numericalSeparator } from 'persian-utilities';
numericalSeparator(entryNumber, separateLength?: number, separator?: string)
```

```javascript
import { numericalSeparator } from 'persian-utilities';
// without Passing Any Option
numericalSeparator(100000); // result : 100,000
// with Customized options
numericalSeparator('10000', 2, '.'); // result : 1.00.00
```

#### numericalSeparator Arguments

| index | argument                  | type             | default value |
| ----- | ------------------------- | ---------------- | ------------- |
| 1     | entryNumber               | string or number | -             |
| 2     | separateLength (optional) | number           | 3             |
| 3     | separator (optional)      | string           | ","           |

### numericalWithoutSeparator

```javascript
import { numericalWithoutSeparator } from 'persian-utilities';
numericalWithoutSeparator(numberWithSeparator: string, separator?: string)
```

```javascript
import { numericalWithoutSeparator } from 'persian-utilities';
// without Passing Any Option
numericalWithoutSeparator(100000); // result : 100,000
// with Customized options
numericalWithoutSeparator(1.00.00 , "."); // result : 10000
```

### wordifynumbers

We Supported Entry Number Less Than 1 Trillion

```javascript
import { wordifynumbers } from 'persian-utilities';
wordifynumbers(5620); // result : پنج هزار و ششصد و بیست
wordifyNumbers(153000); // result : یکصد و پنجاه و سه هزار
wordifyNumbers('۵۲۴۴۲۴۴۳۶۰۰'); // result : پنجاه و دو میلیارد و چهارصد و چهل و دو میلیون و چهارصد و چهل و سه هزار و ششصد
```


### abbNumber

Convert long number into abbreviated string

```javascript
import { abbNumber } from 'persian-utilities';
abbNumber(5620); // result : "5K"
abbNumber(1530000); // result : "1M"    
abbNumber(52100000,1); // result : "52.1M"
```

#### Large number abbreviations

| number               | abbr   | name   |
| -------------------- | ------ | ------ |
| >10^3                | K      | kilo   |
| >10^6                | M      | mega   |
| >10^9                | G      | giga   |
| >10^12               | T      | tera   |
| >10^15               | P      | peta   |
| >10^18               | E      | exa    |

---
_Source: https://npm.io/package/persian-utilities · Machine-readable twin of the npm.io package page. Health data is recomputed on every publish._
