Git Product home page Git Product logo

persian-number's Introduction

Persian-Number

A Library that Makes You Able to Convert any Number to Persian Word. This Library Supports Decimal Point, Negative Numbers and Percent.

With npm

use npm i persian-number or yarn add persian-number then use:

const PN = require("persian-number");

or you can use:

import PN from "persian-number";

Functions

To Use This Library You Can Call All of it's Functions using PN.functionName();

PN.convert(number);

Input: a number as int or float or string

Output: Converted Number to it's Word (string)

Example:

PN.convert(123); // صد و بیست و سه
PN.convert(-123.2); // منفی صد و بیست و سه ممیز دو دهم
PN.convert("-123.26%"); //منفی صد و بیست و سه ممیز بیست و شش صدم درصد

PN.sliceNumber(number,separator=",");

Input: a number as int or float or string and a separator(Optional) (number should be in english)

Output: The number is separated by three digits of the three digits, then return it. (string)

Example:

PN.sliceNumber(12345); // 12,345

PN.convertEnToPe(number);

Input: a number as int or float or string (English Digits)

Output: Returns Converted English Digits into Persian Digits. (string)

Example:

PN.convertEnToPe(123); // ۱۲۳

PN.convertPeToEn(number);

Input: a number as string (Persian Digits)

Output: Returns Converted Persian Digits into English Digits. (string)

Example:

PN.convertPeToEn("۱۲۳"); // 123

For More Examples See index.js

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.