npm package discovery and stats viewer.

Discover Tips

  • General search

    [free text search, go nuts!]

  • Package details

    pkg:[package-name]

  • User packages

    @[username]

Sponsor

Optimize Toolset

I’ve always been into building performant and accessible sites, but lately I’ve been taking it extremely seriously. So much so that I’ve been building a tool to help me optimize and monitor the sites that I build to make sure that I’m making an attempt to offer the best experience to those who visit them. If you’re into performant, accessible and SEO friendly sites, you might like it too! You can check it out at Optimize Toolset.

About

Hi, 👋, I’m Ryan Hefner  and I built this site for me, and you! The goal of this site was to provide an easy way for me to check the stats on my npm packages, both for prioritizing issues and updates, and to give me a little kick in the pants to keep up on stuff.

As I was building it, I realized that I was actually using the tool to build the tool, and figured I might as well put this out there and hopefully others will find it to be a fast and useful way to search and browse npm packages as I have.

If you’re interested in other things I’m working on, follow me on Twitter or check out the open source projects I’ve been publishing on GitHub.

I am also working on a Twitter bot for this site to tweet the most popular, newest, random packages from npm. Please follow that account now and it will start sending out packages soon–ish.

Open Software & Tools

This site wouldn’t be possible without the immense generosity and tireless efforts from the people who make contributions to the world and share their work via open source initiatives. Thank you 🙏

© 2024 – Pkg Stats / Ryan Hefner

persianhelper

v1.0.4

Published

[![npm version](https://img.shields.io/npm/v/persianhelper.svg?style=flat-square)](https://www.npmjs.org/package/persianhelper) [![install size](https://img.shields.io/badge/dynamic/json?url=https://packagephobia.com/v2/api.json?p=persianhelper&query=$.i

Downloads

14

Readme

Persian Helper

A package for the Persian programmer community and validation, correction and production of Persian strings or Iranian cases

npm version install size npm bundle size npm downloads jsDeliver

Installing

Package manager

Using npm:

 npm install persianhelper

Using yarn:

 yarn add persianhelper

Usage/Examples

Once the package is installed, you can import the library using import or require approach:

import {
  arabicToPersian,
  isFullName,
  generateNationalCode,
  phoneNumberInfo,
} from "persianhelper";
const persianHelper = require("persianhelper");

Parser :

You can parse Arabic number and characters to Persian number and characters

Character :

Conver Characters

Arabic to Persian :

convert all Arabic characters to Persian Charaters

import { arabicToPersian } from "persianhelper";

arabicToPersian("جُمُعَةِ"); // "جمعه"
arabicToPersian("يحيي ١٤٩"); // "یحیی ۱۴۹"

SwitchKey :

convert all Persian or Arabic Characters to English Character in keyboard

import { switchKey } from "persianhelper";

switchKey("لخخلمث.زخئ"); // "google.com"

HalfSpace :

add half space to the text

import { halfSpace } from "persianhelper";

halfSpace("این متن تست می باشد."); // "این متن تست می‌باشد."

Number :

Parse the number to anything you want

Arabic, Persian to English :

Parse the Persian number to English number

import { numberToEnglish } from "persianhelper";

numberToEnglish("۰۱۲۳۴۵۶۷۸۹"); // "0123456789"

Seperate Number :

Parse the number to price number

import { seperateNumber } from "persianhelper";

seperateNumber("1200000000"); // -> return -> "1,200,000,000"

seperateNumber("۱۳۴۵۲۳۴۴۰"); // "134,523,440"

Number To word :

Parse the Number to Persian word

import { numberToWord } from "persianhelper";

numberToWord(10564523); // "ده میلیون و پانصد و شصت و چهار هزار و پانصد و بیست و سه"

Validation :

You can validate your string and anything this time I added to this package

String Input :

Checking String Input thing

FullName :

Check fullName, If it's valid return true otherwise return false

import { isFullName } from "persianhelper";

isFullName("علی"); // false
isFullName("علی محمدی"); // true

Date Time :

Check Date and Time, If it's valid return true otherwise return false

import { isDate, isTime, isDateTime } from "persianhelper";

isDate("1402/06/20"); // true
isTime("21:06"); // true
isDateTime("1402/06/20 21:06"); // true

Email :

Check Email, If it's valid return true otherwise return false

import { isEmail } from "persianhelper";

isEmail("[email protected]"); // true

NationalId NationaCode :

Valid and generate NationalId and NationaCode

Validator :

Check NationalId and NationalCode, If it's valid return true otherwise return false (NationalId for legal entities and NationalCode for real people)

import { isNationalId, isNationalCode } from "persianhelper";

isNationalId("14007650912"); // true
isNationalCode("8497548795"); // true

Generate :

Generate NationalCode

import {
  generateNationalCode,
  generateNationalCodeRound,
  placeOfNationalCode,
} from "persianhelper";

generateNationalCode(); // "8497548795"
generateNationalCodeRound(); // "8000011018"
placeOfNationalCode("442"); // { city: 'یزد', province: 'یزد', codes: [ '442', '443' ] }

Postal Code :

Check PostalCode, If it's valid return province and city of postalCode

import { postalCodeInfo } from "persianhelper";

postalCodeInfo("891");
/*  
{
  code: 891,
  city: 'یزد',
  cityEnglishName: 'Yazd',
  provinceId: 31,
  province: 'یزد',
  originLat: '31.88352203369140',
  originLng: '54.34774017333980'
}
 */

PlateNumber :

Check plateNumber, If it's valid return province and city of postalCode

import { plateNumberInfo } from "persianhelper";

plateNumberInfo({ numbers: "1132144", char: "ج" });
/*  
{
  type: 'Car',
  template: '11ج321ایران44',
  details: {
    firstTwoDigits: '11',
    plateCharacter: 'ج',
    nextThreeDigits: '321',
    provinceCode: '44'
  },
  province: 'تهران',
  category: 'شخصی'
}
 */

PhoneNumber :

Check phoneNumber and If it's valid return province and city of postalCode

import { isPhoneNumber, phoneNumberInfo } from "persianhelper";

isPhoneNumber("09124446677"); // true
phoneNumberInfo("09124446677");
/*  
{
  province: [
    'البرز',
    'زنجان',
    'سمنان',
    'قزوین',
    'قم',
    'برخی از شهرستان های استان مرکزی'
  ],
  base: 'تهران',
  type: [ 'دائمی' ],
  operator: 'همراه اول'
}
 */

Banking :

Check shebaNumber, bankNameCard and If it's valid return bankName and other info

import { shebaNumberInfo, bankNameCard, isShebaNumber } from "persianhelper";

isShebaNumber("IR270170000000100324200001"); // true
bankNameCard("504172"); // "بانک رسالت"
shebaNumberInfo("IR270170000000100324200001");
/*  
{
  code: '017',
  nickname: 'melli',
  name: 'Melli',
  persianName: 'بانک ملی ایران',
  accountNumberAvailable: false
}
 */