New Case Study:See how Anthropic automated 95% of dependency reviews with Socket.Learn More
Socket
Sign inDemoInstall
Socket

national-identity-validator

Package Overview
Dependencies
Maintainers
1
Versions
14
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

national-identity-validator

Mauritius National Identity Validator

  • 3.0.1
  • latest
  • Source
  • npm
  • Socket score

Version published
Maintainers
1
Created
Source

NATIONAL IDENTITY NUMBER VALIDATOR

This Module validate the NIN of a user by doing a mathematical operation.

The Operation is as follows:

Instruction

  • To install the package simply execute:

    npm install national-identity-validator

  • Then in your file import the module:

    import validateNationalIdentityNumber from 'national-identity-validator';

    validateNationalIdentityNumber(nid: 'string', lastname?: 'string', dob?: 'object' | 'string'); //return an object

    date of birth string data should be in the format YYYY-MM-DD or YYYY/MM/DD

    The parameter lastname is optional which will validate the last name of the person by comparing the first character of the last name with the first character from the nid.

    The parameter dob is optional which will validate the date of birth of the person by comparing the dob with the date of birth of the person from the nid.

    The object return is as follows:

        {
            isValid :         boolean,
            isNidValid:       boolean,
            isSurnameValid:   boolean,
            isValidDob:       boolean,
            age:               number
        }
    

How to use

  • To use the validateNationalIdentityNumber package
     import validateNationalIdentityNumber from 'national-identity-validator';

     validateNationalIdentityNumber("S0808739500", "Sample", "YYYY-MM-DD"); //return an object


Issues about type

  • Simply add type in your package.json file

    "type": "module",

Keywords

FAQs

Package last updated on 04 Apr 2023

Did you know?

Socket

Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.

Install

Related posts

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc