Security News
UK Officials Consider Banning Ransomware Payments from Public Entities
The UK is proposing a bold ban on ransomware payments by public entities to disrupt cybercrime, protect critical services, and lead global cybersecurity efforts.
singapore-nric
Advanced tools
Generate & Validate Singapore NRIC (National Registration Identity Card) Numbers
A Singapore NRIC Validator & Generator class, by Samuel Liew
Looking to do it manually instead? Use these tools on my website: generate or validate.
npm -i singapore-nric
import NRIC from 'singapore-nric';
const n = new NRIC('S1234567D');
Property | Type | Description |
---|---|---|
value | string | entire value of NRIC |
firstchar | string | first character |
identifier | string | last four alphanumeric characters |
checksum | string | checksum (last character) |
isCorrectFormat | boolean | format is valid |
isValid | boolean | checksum is valid |
n.value; // 'S1234567D'
n.firstchar; // 'S'
n.identifier; // '567D'
n.checksum; // 'D'
n.isCorrectFormat; // true
n.isValid; // true
Validate( nric )
Validate a single NRIC, or an array of NRIC strings
@param {string|string[]|NRIC|NRIC[]} nric
- (single or array of) NRIC strings or NRIC instances
@returns {boolean}
- true if all are valid NRICs
NRIC.Validate('S1234567D'); // true
NRIC.Validate([ 'S1234567D', 'S1234567D' ]); // true
Generate( firstchar? )
Returns a random NRIC with valid checksum
@param {string} firstchar
- (optional) set first character
@returns {NRIC}
- NRIC number
NRIC.Generate(); // e.g.: 'S1234567D'
NRIC.Generate('M'); // e.g.: 'M1235467X'
GenerateMany( amount )
Generate an array of NRICs with valid checksum
@param {number} amount
- number to generate
@returns {NRIC[]}
- an array of NRIC numbers
NRIC.GenerateMany(3); // e.g.: [ 'S1234567D', 'S1234567D', 'S1234567D' ]
See tests.
FAQs
Generate & Validate Singapore NRIC (National Registration Identity Card) Numbers
The npm package singapore-nric receives a total of 401 weekly downloads. As such, singapore-nric popularity was classified as not popular.
We found that singapore-nric demonstrated a healthy version release cadence and project activity because the last version was released less than a year ago. It has 1 open source maintainer collaborating on the project.
Did you know?
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.
Security News
The UK is proposing a bold ban on ransomware payments by public entities to disrupt cybercrime, protect critical services, and lead global cybersecurity efforts.
Security News
Snyk's use of malicious npm packages for research raises ethical concerns, highlighting risks in public deployment, data exfiltration, and unauthorized testing.
Research
Security News
Socket researchers found several malicious npm packages typosquatting Chalk and Chokidar, targeting Node.js developers with kill switches and data theft.