1.0.9 • Published 2 years ago

sgidvalidator v1.0.9

Weekly downloads
-
License
MIT
Repository
-
Last release
2 years ago

Nricvalidator

Demo

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/sgidvalidator@1.0.7/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");
1.0.9

2 years ago

1.0.8

2 years ago

1.0.7

2 years ago

1.0.6

2 years ago

1.0.5

3 years ago

1.0.4

3 years ago

1.0.2

3 years ago

1.0.3

3 years ago

1.0.1

3 years ago

1.0.0

3 years ago