Skip to content
/ dni-js Public
forked from albertfdp/dni-js

Compute and validate a Spanish DNI/NIE number

License

Notifications You must be signed in to change notification settings

jvmonjo/dni-js

 
 

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

9 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

dni-js

Compute and validate a Spanish DNI/NIE numbers as described here.

Build Status npm version

Install

$ npm install dni-js

Usage

Validation is based on this document.

const dni = require('dni-js');

dni.isValid('12345678-Z'); // => true

API

.dni (number|string)

Returns a DNI number with the control digit appended in the format 12345678-Z. If the input is invalid, returns null.

.nie (number|string)

Returns a NIE number with the control digit appended in the format X1234567-L. If the input is invalid, returns null.

.getControlDigit (number|string)

Returns the control digit for the input.

.getLetter (number|string)

Alias for getControlDigit.

.isValid (string)

Returns true or false by validating the input.

License

MIT

About

Compute and validate a Spanish DNI/NIE number

Resources

License

Stars

Watchers

Forks

Packages

No packages published

Languages

  • JavaScript 100.0%