usdl-regex
Version:
US Driver's License validation via https://ntsi.com/drivers-license-format/
64 lines (46 loc) • 1.79 kB
Markdown
usdl-regex
==========
[](https://app.wercker.com/project/byKey/50fd960ab71deb402345dddc7c3a5ee4)
Node package for validating US Drivers License numbers. Based on other similar language modules which originate from https://ntsi.com/drivers-license-format/
Usage
=========
Pass in a State and a DL Number and it'll validate if it's true or false
```
const { isValid } = require('usdl-regex');
const state = 'CA';
const truthyResult = isValid(state, 'F1112001');
// returns true
const falsyResult = isValid(state, 'ABC1112001');
// returns false
```
Pass in a State and a DL Number and it'll validate if it's true or false.
If it is "false", then it will return a description on what it expects
```
const { isValidOrReturnDescription } = require('usdl-regex');
const state = 'CA';
const truthyResult = isValidOrReturnDescription(state, 'F1112001');
// returns true
const falsyResult = isValidOrReturnDescription(state, 'ABC1112001');
// returns ["1 Alpha + 7 Numeric"]
```
CHANGELOG
=========
- Add new OR patter from evidence of valid licenses
- Add new MO pattern from evidence of valid licenses, even though I cannot find a spec to say why
- Fix Massachsetts to accept new DL format starting with "SA"
- Fixed small readme issues
- Added a new method "isValidOrReturnDescription" to return description on falsy validation
- Fixed some test cases
- Edit README to contain "Usage" instructions
Fix Nebraska regex to allow 1Alpha+6-8Numeric
Fix Oregon to allow A+6Numeric
Fix Kentucky regex type from A_Z to A-Z