Giter VIP home page Giter VIP logo

persian-utilities's Introduction

persian-utilities

alt text

License: MIT

Persian Modules need to Improved Application.
Collections of Persian Utils And Helpers Function.

Collections

Install

NPM

npm install persian-utilities

Usage

Import persian-utilities into your app's modules or import ES modules With Name

Apis

convertDigitsFaToEn

import { convertDigitsFaToEn } from 'persian-utilities';
convertDigitsFaToEn('۱۲۳۴'); // result : 1234

convertDigitsEnToFa

import { convertDigitsEnToFa } from 'persian-utilities';
convertDigitsEnToFa('1234'); // result : ۱۲۳۴

persianCardValidation

import { persianCardValidation } from 'persian-utilities';
persianCardValidation('6219861054512345'); // result : {bankName : "بانک سامان" , isValid : true}

timeAgo

second argument set Exact option

import { timeAgo } from 'persian-utilities';
// not exact mode
timeAgo('۱۴۰۱/۰۵/۰۹ ۱۰:۰۰'); // result : روز قبل 1
// exact mode
timeAgo('۱۴۰۱/۰۵/۰۹ ۱۰:۰۰', true); // result : ثانیه29 و ساعت2 و روز1

isNationalID

import { isNationalID } from 'persian-utilities';
isNationalID('1111111111'); // result : true

numericalSeparator

import { numericalSeparator } from 'persian-utilities';
numericalSeparator(entryNumber, separateLength?: number, separator?: string)
import { numericalSeparator } from 'persian-utilities';
// without Passing Any Option
numericalSeparator(100000); // result : 100,000
// with Customized options
numericalSeparator('10000', 2, '.'); // result : 1.00.00

numericalSeparator Arguments

index argument type default value
1 entryNumber string or number -
2 separateLength (optional) number 3
3 separator (optional) string ","

numericalWithoutSeparator

import { numericalWithoutSeparator } from 'persian-utilities';
numericalWithoutSeparator(numberWithSeparator: string, separator?: string)
import { numericalWithoutSeparator } from 'persian-utilities';
// without Passing Any Option
numericalWithoutSeparator(100000); // result : 100,000
// with Customized options
numericalWithoutSeparator(1.00.00 , "."); // result : 10000

wordifynumbers

We Supported Entry Number Less Than 1 Trillion

import { wordifynumbers } from 'persian-utilities';
wordifynumbers(5620); // result : پنج هزار و ششصد و بیست
wordifyNumbers(153000); // result : یکصد و پنجاه و سه هزار
wordifyNumbers('۵۲۴۴۲۴۴۳۶۰۰'); // result : پنجاه و دو میلیارد و چهارصد و چهل و دو میلیون و چهارصد و چهل و سه هزار و ششصد

abbNumber

Convert long number into abbreviated string

import { abbNumber } from 'persian-utilities';
abbNumber(5620); // result : "5K"
abbNumber(1530000); // result : "1M"    
abbNumber(52100000,1); // result : "52.1M"

Large number abbreviations

number abbr name
>10^3 K kilo
>10^6 M mega
>10^9 G giga
>10^12 T tera
>10^15 P peta
>10^18 E exa

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.