Miss any of our Open RFC calls?Watch the recordings here! »

persian-digit-tools

1.0.2 • Public • Published

Digit Convertor

Build Status Coverage Status

a lightweight library for projects that allow you to parse the digits inside of your strings to persian and vice versa.

Installation

run one of these commends on your project root:

npm install persian-digit-tools --save
yarn add persian-digit-tools
bower install persian-digit-tools --save

Usage

first, you must import it

Javascript

var convertor = require('persian-digit-tools').DigitConvertor;

Typescript

import { DigitConvertor } from 'persian-digit-tools';

then you can use it like this:

let str = 'hello 123.sda31 this1233is a complex 1';
console.log(convertor.toPersian(str)); // it will print 'hello ۱۲۳.sda۳۱ this۱۲۳۳is a complex ۱'
 
let str = '۱۲۳۴۵۶ ۳۲۱۳ ۶۴۱۲۳,۲۳۱';
console.log(convertor.toEnglish(str)); // it will print '123456 3213 64123,231'

Test

you can see test inside of test folder and for run tests use this command:

npm run test

Contribute

feel free to fork and do what ever you want (or send pull requests).

for contribute this project, first clone the project and go to project folder:

git clone https://github.com/MetaiR/persian-digit-tools.git
cd persian-digit-tools

then run:

npm install

after that you ready to go :D

Install

npm i persian-digit-tools

DownloadsWeekly Downloads

7

Version

1.0.2

License

SEE LICENSE IN LICENSE

Unpacked Size

9.85 kB

Total Files

9

Last publish

Collaborators

  • avatar