{"id":20767835,"url":"https://github.com/fandogh/codemeli","last_synced_at":"2025-04-30T11:21:28.146Z","repository":{"id":57202352,"uuid":"84546903","full_name":"fandogh/codemeli","owner":"fandogh","description":"Iranians national number (NID,SSN) parser \u0026 validator","archived":false,"fork":false,"pushed_at":"2023-09-12T08:52:17.000Z","size":129,"stargazers_count":27,"open_issues_count":4,"forks_count":2,"subscribers_count":3,"default_branch":"master","last_synced_at":"2025-04-15T19:05:54.052Z","etag":null,"topics":["code","iran","iranian","meli","melli","national","national-number","nid","persian","ssn"],"latest_commit_sha":null,"homepage":"","language":"JavaScript","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"mit","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/fandogh.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":"LICENSE","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null}},"created_at":"2017-03-10T10:11:10.000Z","updated_at":"2025-02-11T21:33:12.000Z","dependencies_parsed_at":"2023-01-22T18:00:49.886Z","dependency_job_id":null,"html_url":"https://github.com/fandogh/codemeli","commit_stats":null,"previous_names":[],"tags_count":0,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/fandogh%2Fcodemeli","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/fandogh%2Fcodemeli/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/fandogh%2Fcodemeli/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/fandogh%2Fcodemeli/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/fandogh","download_url":"https://codeload.github.com/fandogh/codemeli/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":251688999,"owners_count":21627814,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":["code","iran","iranian","meli","melli","national","national-number","nid","persian","ssn"],"created_at":"2024-11-17T11:33:35.447Z","updated_at":"2025-04-30T11:21:28.114Z","avatar_url":"https://github.com/fandogh.png","language":"JavaScript","funding_links":[],"categories":[],"sub_categories":[],"readme":"# CodeMeli\n\u003e Iranians national number (NID,SSN) parser \u0026 validator \n\n[![CircleCI](https://img.shields.io/circleci/project/github/fandogh/codemeli.svg?style=flat-square)](https://circleci.com/gh/fandogh/codemeli)\n[![npm](https://img.shields.io/npm/v/codemeli.svg?style=flat-square)](https://www.npmjs.com/package/codemeli)\n\n**Node.js**\n\n# City codes\n\n```bash\n# Using Yarn\nyarn add codemeli\n# Using NPM\nnpm install --save codemeli\n```\n\n**Browser**\n\n```html\n\u003cscript src=\"https://unpkg.com/codemeli@1.0.2\" type='text/javascript'\u003e\u003c/script\u003e \n```\n\n## API\nThis packages exports `codemeli(code,returnObj)` function\n\n**code**\n\nNational number value. it can be string or number, both are supported.\n\n**return value**\n\nIf for any reason input is invalid it will return `null` Otherwise It will return a formatted **10 digits** code.\n\nIf returnObj is true (defaults to `false`) function will return an object with this fields instead:\n- code\n- parity\n- city_code\n- uid\n\n## Example\n\n```js\nconst codemeli = require('codemeli');\n\nvar inputValue='xxxxxxxxxx'; // TODO: Change this value\n\n// Simple usage\nconst national_number = codemeli(inputValue);\n\nconsole.log(national_number); // xxxxxxxxxx\n\n// Object style\nconst national_number_obj = codemeli(inputValue, true);\n\n/*\n{\n  code: 'xxxxxxxxxx',\n  parity: 'x',\n  city_code: 'xx',\n  uid: 'xxxxxxx' \n}\n*/\nconsole.log(national_number_obj);\n``` \n\n## Algorithm\nParity checking algorithm extracted from an article from [aliarash.com](http://www.aliarash.com/article/codemeli/codemeli.htm)\n(Also available [here](https://fandogh.github.io/codemeli/codemeli.html))\n\n## City \u0026 State DB [WIP]\nUnfortunately there is no public official db of city codes and there was typos in unofficial ones.\nI tried my best to detect typos by both comparing all of them and user comments.\nHere is the list of discovered references:\n\n- [yasa.co](https://www.yasa.co/%D8%A7%D8%AF%D8%A7%D8%B1%D9%87-%D8%AB%D8%A8%D8%AA-%D8%A7%D8%AD%D9%88%D8%A7%D9%84/%DA%A9%D8%AF-%D9%85%D9%84%DB%8C-%D9%88-%D8%B4%D9%87%D8%B1-%D9%85%D8%AD%D9%84-%D8%B5%D8%AF%D9%88%D8%B1-%D8%A2%D9%86-%D8%B4%D9%87%D8%B1-%D9%85%D8%AD%D9%84-%D8%AA%D9%88%D9%84%D8%AF)\n- [police10.blog.ir](http://police10.blog.ir/post/220/Search%20Iranian%20national%20code%20for%20each%20city)\n- [it-office.ir](http://www.it-office.ir/index.php?option=com_content\u0026view=article\u0026id=133\u0026Itemid=794)\n- [codemelli.blogfa.com](http://codemelli.blogfa.com/post-2.aspx)\n \nPlease check [docs/city_codes.json](docs/citiy_codes.json) and [docs/missing_cities.txt](docs/missing_cities.txt) for more info.\n\n## Read More\n- [Wikipedia](https://en.wikipedia.org/wiki/Iranian_national_identity_card)\n- [Wikipedia + Algorithm (Persian)](https://fa.wikipedia.org/wiki/Iranian_national_identity_card)\n- [IR Family](http://irfamily.com/iranian-national-identity-card/)\n- [History of iranian identify cards (Persian)](http://www.farsnews.com/newstext.php?nn=13941107000664)\n\n## Related projects\n- [rghorbani/node-iranian-ssn](https://github.com/rghorbani/node-iranian-ssn)\n- [rghorbani/iranian-ssn-gem](https://github.com/rghorbani/iranian-ssn-gem)\n\n## LICENSE\nMIT License Copyright (c) 2017 Fandogh - [Pooya Parsa](mailto:pooya@pi0.ir)\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Ffandogh%2Fcodemeli","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Ffandogh%2Fcodemeli","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Ffandogh%2Fcodemeli/lists"}