Giter VIP home page Giter VIP logo

persianize-node's Introduction

persianize-node

NPM version Build Status Downloads

Persianize is set of nodejs tools for validating and converting data in correct Persian.

Installation

Via npm

If you have a package.json file in your directory you can require the package and run npm install

{
    "name": "persianize",
    "version": "2.0.0"
}

Or run following command to direct usage

npm install persianize

Manual installation

If you didn't use dependency management systems you can install persianize in manual way, download ZIP file and then extract it and all you need is require 'Persianize.js' file on your project and use it.

Import

You can use both persianize validator and convert in one single object, like every node module you should import this package to your file.

var persianize = require('persianize');

Convert

This object helps you to change phrases to right Persian

Number

Convert English and Arabic numbers to right Persian numbers.

persianize.convert().number('0123456789').get(); // Output --> ۰۱۲۳۴۵۶۷۸۹

Remove Arabic character

Remove Arabic keyboard characters from Persian text.

persianize.convert().removeArabicChar('فارسي').get(); // Output --> فارسی

Replace space with half-space

Detect persian verbs and replace space with half-space

persianize.convert().halfSpace('می روی').get(); // Output --> می‌روی

Full Convert

This method will convert number, convert arabic characters to Persian and replace space with half-space.

persianize.convert().all('فارسي 1').get(); // Output --> فارسی ۱

Validate

Validating Persian language inputs like Persian number, Persian alphabet...

Alphabel

Validate Persian Alphabet

persianize.validator().alpha('فارسی'); // Output --> TRUE

Number

Validate Persian Number

persianize.validator().number('۱۲۳'); // Output --> TRUE

Alpha_Num

Validate Persian Alphabet and numbers

persianize.validator().alphaNum('۳فارسی'); //Output --> TRUE

Text

Validate Persian alphabet, numbers, space, half-space and special characters.

persianize.validator().text('۳ فارسی') //Output --> TRUE

Mobile

Validate Iran mobile number.

persianize.validator().mobile('09355555555') //Output --> TRUE

Crad_Number

Validate Iran crad number.

persianize.validator().cradNumber('6274129005473742') //Output --> TRUE

Phone

Validate Iran phone number.

persianize.validator().phone('37236445') //Output --> TRUE

Postal_Code

Validate Iran postal code.

persianize.validator().postalCode('1619735744') //Output --> TRUE

Sheba

Validate Iran sheba number.

persianize.validator().sheba('IR062960000000100324200001') //Output --> TRUE

Meli_Code

Validate Iran meli code.

persianize.validator().meliCode('0013542419') //Output --> TRUE

persianize-node's People

Contributors

imehdihosseini avatar orthographic-pedant avatar shahrokhniakan avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar

Forkers

sinapcs

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.