A simpler way to validate Thai Citizen Card ID. πΉπ
- Go Language Implementation Example
- Thai Passport Number Validation
Building Thai Citizen ID Input Validation with WCAG Standard
$ npm install thai-id-validator
# or
$ yarn add thai-id-validator
Input | Output |
---|---|
String | boolean |
Just import script with commonjs
var validThaiID = require('thai-id-validator') // for ES5
var result = validThaiID(β1101700207030β);
// return true
In Javascript file, you can use import, export modules
'use strict';
import validThaiID from 'thai-id-validator';
let result = validThaiID(β1101700207030β);
// return true
To run all test cases run the following command
npm run test
You can edit validator.test.js too add your custom test case.
Test Cases | Result |
---|---|
1112034563562 | β |
1101700230705 | β |
110170023073 | β |
11017002070d3 | β |
rytege54fsfsf | β |
0 | β |
'-' | β |
'' | β |
null | β |
'blablabla' | β |
(Tested with Jest)
Supports all major browsers and IE11+
IE / Edge |
Firefox |
Chrome |
Safari |
Opera |
---|---|---|---|---|
11+ | 44+ | 45+ | 11+ | 32+ |
If you found any π or feedback, please report the issue here
π©π»βπ» Contribute are always welcome.
Code with love π¦