# vue-persian-input-digit

> a simple, Vue.js directive for persian input digit

Latest version **2.0.6** (published 2022-02-06) · ISC license · 22 weekly downloads

## Install

```sh
npm install vue-persian-input-digit
pnpm add vue-persian-input-digit
yarn add vue-persian-input-digit
bun add vue-persian-input-digit
```

## 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 | 2.0.6 |
| Published | 2022-02-06 |
| First published | 2021-08-17 |
| Weekly downloads | 22 |
| License | ISC |
| TypeScript types | none |
| Module format | CommonJS |
| Dependencies | 1 |
| Unpacked size | 5.7 KB |
| Known vulnerabilities | 0 (+1 in 1 direct dependencies) |
| Install scripts | no |
| GitHub stars | 3 |
| Author | MiladHp |
| Maintainers | miladhp |
| Keywords | persian, input, persian-number, digit, separator, comma-separator, thousand-separator |

## Links

- npm: https://www.npmjs.com/package/vue-persian-input-digit
- Repository: https://github.com/emechpi/vue-persian-input-digit
- Issues: https://github.com/miladhp/vue-persian-input-digit/issues
- npm.io page: https://npm.io/package/vue-persian-input-digit

## Dependencies (1)

- [vue](https://npm.io/package/vue.md) ^2.6.14

## 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

- 2.0.6 (latest) — 2022-02-06
- 2.0.5 — 2022-02-06
- 2.0.4 — 2022-01-25
- 2.0.3 — 2022-01-25
- 2.0.2 — 2021-12-26
- 2.0.1 — 2021-08-21
- 1.0.0 — 2021-08-17

## README

`vue-persian-input-digit` - a simple, Vue.js directive for persian and arabic input digit.

### Usage
- Prevent non-digit characters (just digit numbers 0-9)
- Convert Arabic and Persian numbers in input to English digit
- Add separator to input value\
    eg: \
        - thousand separator: 120000000 => 120,000,000 \
        - credit card format: 6219861012345678 => 6219-8610-1234-5678
### Installation

npm:
```bash
npm install vue-persian-input-digit --save
```

yarn:
```bash
yarn add vue-persian-input-digit --save
```

### Use

 1. in this case just add ```v-input-digit``` as a directive on element.\
 this usage prevent user to enter non-digit values and just accept numeric values.\
 and also convert Persian or Arabic digits to English digits in input.

```html
<template>
  <div>
    <input type="text" v-input-digit />
  </div>
</template>

<script>
import VueInputDigit from 'vue-persian-input-digit'

export default {
  directives: {
    VueInputDigit
  },
  data() {
      return {
          value: '۱۰۰۰۰۰۰' // formatted value => '1000000'
      }
  }
}
</script>
```

 2. in this case you can add ```v-input-digit={ block: number, delimiter: string }``` as a directive on element.
>```block```: A Number value that will insert delimiters in between these groups.\
```delimiter```: A String value indicates the delimiter to use in formatting.
```js
    v-input-digit={ block: 3, delimiter: ',' } //150230000 => 150,230,000
```
```js
    v-input-digit={ block: 2, delimiter: '/' } //990525 => 99/05/25
```
```js
    v-input-digit={ block: 4, delimiter: '-' } //6219861012345678 => 6219-8610-1234-5678
```


```html
<template>
  <div>
    <input type="text" v-model="value" v-input-digit="{ block: 3, delimiter: ',' }" />
  </div>
</template>

<script>
import VueInputDigit from 'vue-persian-input-digit'

export default {
  directives: {
    VueInputDigit
  },
  data() {
    return {
        value: 2500000 // formatted value => 2,500,000
    }
  }
}
</script>
```

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