sgidvalidator
v1.0.9
Published
Singapore identification no. validator
Downloads
16
Readme
Nricvalidator
Takes a string input and validates it using calculated checksum based on http://www.ngiam.net/NRIC/NRIC_numbers.pdf
WIP
Read more on Rollup
IIFE
<!-- script.html -->
...
<body>
<input type="text" maxlength="9" pattern=".{9}" onkeyup="checknric(this)" required />
</body>
...
<script src="https://unpkg.com/[email protected]/dist/js/nricvalidator.js"></script>
<script>
function checknric(element) {
var valid = nricvalidator.validate(element.value);
if (!valid) alert("invalid!");
}
</script>
ES Modules
npm i nricvalidator
import { validate } from "sgidvalidator";
const isValid = validate("S1234567H");