Skip to content

persian-tools/react-persian-tools

Repository files navigation

react-persian-tools

React wrapper component around persian tools

CI/CD codecov GitHub license PRs Welcome CodeFactor NPM Storybook GitHub contributors


Demo

https://persian-tools.github.io/react-persian-tools/

alt text

Install

npm install --save react-persian-tools

Usage

import React, { Component } from 'react'

import PersianTools from 'react-persian-tools'

class Example extends Component {
  render() {
    return (
      <>
        <PersianTools.WordsToNumber>منفی سه هزارمین</PersianTools.WordsToNumber>
        <PersianTools.WordsToNumber fuzzy>یگصد و بنجاه هزار</PersianTools.WordsToNumber>
        <PersianTools.NumberToWords>500,443</PersianTools.NumberToWords>
        <PersianTools.NumberToWords ordinal>500,443</PersianTools.NumberToWords>
        <PersianTools.AddCommas>30000000</PersianTools.AddCommas>
        <PersianTools.RemoveCommas>30,000,000</PersianTools.RemoveCommas>
        <PersianTools.DigitsArToEn>٠١٢٣٤٥٦٧٨٩</PersianTools.DigitsArToEn>
        <PersianTools.DigitsArToFa>٠١٢٣٤٥٦٧٨٩</PersianTools.DigitsArToFa>
        <PersianTools.DigitsEnToFa>123۴۵۶</PersianTools.DigitsEnToFa>
        <PersianTools.DigitsFaToEn>123۴۵۶</PersianTools.DigitsFaToEn>
      </>
    )
  }
}

Contributing

Thank you for your interest in contributing! Please feel free to put up a PR for any issue or feature request.

License

This project is licensed under the MIT License - see the LICENSE.md file for details.