1.0.2 • Published 7 years ago
persian-digit-tools v1.0.2
Digit Convertor
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 --saveUsage
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 testContribute
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-toolsthen run:
npm installafter that you ready to go :D