@edyspider/validate-nif
v1.7.8
Published
A package to validate Portuguese fiscal identification numbers (NIF)
Downloads
29
Readme
Validate-NIF
A simple npm package to validate Portuguese fiscal identification numbers (NIF).
Installation
npm i @edyspider/validate-nif
Usage
Javascript
const { validateNIF, randomNIF } = require('@edyspider/validate-nif');
const validNIF = '123456789';
const invalidNIF = '999999999';
const randNIF = randomNIF();
console.log(`Is ${validNIF} a valid NIF?`, validateNIF(validNIF));
console.log(`Is ${invalidNIF} a valid NIF?`, validateNIF(invalidNIF));
console.log(`Generated random NIF: ${randNIF}`);
console.log(`Is generated NIF valid?`, validateNIF(randNIF));
Is 123456789 a valid NIF? true
Is 999999999 a valid NIF? false
Generated random NIF: ?????????
Is generated NIF valid? true
Typescript
import { validateNIF, randomNIF } from '@edyspider/validate-nif';
const isValidNIF = validateNIF('123456789');
const isInvalidNIF = validateNIF('999999999');
const newRandNIF = randomNIF();
console.log('NIF is valid:', isValidNIF);
console.log('NIF is invalid:', isInvalidNIF);
console.log('New random NIF:', newRandNIF);
Is 123456789 a valid NIF? true
Is 999999999 a valid NIF? false
New random NIF: ?????????
Known Issues
Authors
License
- MIT license
- Copyright 2024 © EdySpider