1.1.6 • Published 10 months ago

thai-id-validator v1.1.6

Weekly downloads
69
License
MIT
Repository
github
Last release
10 months ago

Thai Citizen ID Validator

thai-citizen-id-validator

Codacy Badge Codacy Badge NPM Download javascript style guide npm

A simpler way to validate Thai Citizen Card ID. šŸ‡¹šŸ‡­

Minimum Node.js Version āš ļø

This package requires Node.js version 16 or later.

Future Roadmap

  • Go Language Implementation Example
  • .NET Language Implementation Example
  • Thai Passport Number Validation

Read the article

Building Thai Citizen ID Input Validation with WCAG Standard

Installation

$ npm install thai-id-validator
# or
$ yarn add thai-id-validator
# or
$ pnpm add thai-id-validator
# or
$ bun add thai-id-validator

Data Type

InputOutput
Stringboolean

Usage

Javascript / Typescript

In Javascript, Typescript file, you can use import, export modules

import isValidThaiID from 'thai-id-validator';

let result = isValidThaiID(ā€˜1101700207030’);

console.log(result);
// true

Test

To run all test cases run the following command

bun run test

You can edit validator.test.js too add your custom test case.

Test CasesResult
'1112034563562'āœ…
'0113200420331'āœ…
'1101700230705'āŒ
'110170023073'āŒ
'11017002070d3'āŒ
'rytege54fsfsf'āŒ
0āŒ
'-'āŒ
''āŒ
nullāŒ
undefinedāŒ
'blablabla'āŒ

(Tested with Bun)

Test Result Screenshot

How to upload test coverage report to codacy

export CODACY_PROJECT_TOKEN=xxxxxxxxx

bun run coverage

bash <(curl -Ls https://coverage.codacy.com/get.sh)

Compatibility

Tested on all modern browsers āœ…

Issues

If you found any šŸž or feedback, please report the issue here

Contribution

šŸ‘©šŸ»ā€šŸ’» Contribute are always welcome.

License

MIt

Code with love šŸ¦‰

1.1.6

10 months ago

1.1.5

1 year ago

1.1.4

1 year ago

1.1.1

2 years ago

1.1.3

2 years ago

1.1.2

2 years ago

1.1.0

5 years ago

1.0.8

6 years ago

1.0.7

7 years ago

1.0.6

7 years ago

1.0.5

7 years ago

1.0.4

7 years ago

1.0.3

7 years ago

1.0.2

7 years ago

1.0.1

7 years ago

1.0.0

7 years ago