Skip to content

rghorbani/node-iranian-ssn

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

5 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Iranian-SSN

npm

Iranian-SSN lets you validate iranian national code. It checks the code and returns the result as json.

Install

$ npm install iranian-ssn --save

OR

$ yarn add iranian-ssn

Usage

Validation

User .validate(ssn, log = false) to validate your national code.

var result = irssn.validate(ssn);
console.log(result);

result = irssn.validate(ssn, true);
console.log(result);

# => {"status"=>true, "ssn"=>"#ssn", "city_code"=>"044", "city"=>"شمیران", "state"=>"تهران"}
# => false

Cities Database

Unfortunately there is no public official db of city codes and there was typos in unofficial ones. I tried my best to detect typos by both comparing all of them and user comments. Here is the list of discovered references:

Use .cities to access our cities database.

var cities = irssn.cities;

Examples

For a complete, working example, refer to the example.

Tests

$ npm install
$ npm test

Credits

License

The MIT License

Copyright (c) 2015-present Reza Ghorbani Farid <http://rghorbani.ir>

About

The Iranian National Code Validation

Topics

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published