New Research: Supply Chain Attack on Axios Pulls Malicious Dependency from npm.Details
Socket
Book a DemoSign in
Socket

ninvalidation

Package Overview
Dependencies
Maintainers
1
Versions
1
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

ninvalidation

JavaScript utility to validate NIN (National Identification Number)

latest
npmnpm
Version
1.0.0
Version published
Maintainers
1
Created
Source

NIN Validation

A simple JavaScript utility for validating National Identification Number (NIN) formats and toggling instruction visibility.
Works in both Node.js and browser environments.

Installation

npm install nin-validation

Features

  • ✅ Validate NIN numbers against a predefined pattern (XXXXXXXX0XX or XXXXXXXX1XX)
  • ✅ Attach validation directly to input fields
  • ✅ Toggle visibility of NIN instruction elements
  • ✅ Works in vanilla JS, React, Vue, Angular, and other modern frameworks

Usage

1. Import the library

Node.js / CommonJS

const { validateNINField, attachNINValidation, attachToggleInstructions } = require('nin-validation');

ES Modules

import { validateNINField, attachNINValidation, attachToggleInstructions } from 'nin-validation';

2. Validate a NIN directly

console.log(validateNINField("12345678012")); // true
console.log(validateNINField("98765432199")); // false

3. Attach validation to an input field

HTML:

<input type="text" id="txtNIN" />
<span id="labelNINerror" style="display:none;color:red;">Invalid NIN</span>

JavaScript:

attachNINValidation('txtNIN', 'labelNINerror');

4. Toggle NIN instructions

HTML:

<button class="thumb">ℹ️</button>
<div id="ninInstructions" style="display:none;">Enter your 8-digit number followed by 3 digits where the first of the last 3 is 0 or 1.</div>

JavaScript:

attachToggleInstructions('.thumb', '#ninInstructions');

License

MIT License

Keywords

Validation

FAQs

Package last updated on 13 Aug 2025

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