Skip to content

a library for convert english digit to persian and vice versa

License

Notifications You must be signed in to change notification settings

MetaiR/persian-digit-tools

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

15 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

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

About

a library for convert english digit to persian and vice versa

Resources

License

Stars

Watchers

Forks

Packages

No packages published

Contributors 4

  •  
  •  
  •  
  •