|
| 1 | +# Nusantara Valid |
| 2 | + |
| 3 | +Nusantara Valid is a data validator to validate any Indonesian specific civil data such as nik, nip, and many more. |
| 4 | + |
| 5 | +## Table of contents |
| 6 | + |
| 7 | +- [What it can do?](#what-it-can-do) |
| 8 | +- [Getting started](#getting-started) |
| 9 | +- [Usage](#usage) |
| 10 | +- [API](#api) |
| 11 | +- [Creators](#creators) |
| 12 | +- [License](#license) |
| 13 | + |
| 14 | +## What it can do? |
| 15 | + |
| 16 | +- ATM Number (Nomor Rekening) |
| 17 | +- Cellular Number / Mobile Number |
| 18 | +- Credit Card Number |
| 19 | +- E-Mail |
| 20 | +- NIK (Nomor Induk Kependudukan) |
| 21 | +- NIP (Nomor Induk Pegawai Negeri Sipil) |
| 22 | +- NISN (Nomor Induk Siswa Nasional) |
| 23 | +- NPWP (Nomor Pokok Wajib Pajak) |
| 24 | +- TNKB (Tanda Nomor Kendaraan Bermotor) |
| 25 | +- Telephon Number |
| 26 | +- Zip Code |
| 27 | + |
| 28 | +## Getting started |
| 29 | + |
| 30 | +- [Download the latest release.](https://github.com/magicjar/nusantara-valid/) |
| 31 | +- Clone the repo: |
| 32 | + |
| 33 | + `git clone https://github.com/magicjar/nusantara-valid.git` |
| 34 | +- Install with [npm](https://www.npmjs.com/): |
| 35 | + |
| 36 | + `npm install nusantara-valid` |
| 37 | + |
| 38 | +The package includes multiple formats to support different process. |
| 39 | +- **nusantara-valid.cjs.js** - CommonJS module. |
| 40 | +- **nusantara-valid.es.mjs** - ES module. |
| 41 | +- **nusantara-valid.umd.js** - UMD module. Can be used with good-usual-way `script` tag |
| 42 | + |
| 43 | +## Usage |
| 44 | + |
| 45 | +### CommonJS module way (`require()`) |
| 46 | +``` javascript |
| 47 | +const NusantaraValid = require('nusantara-valid') |
| 48 | +``` |
| 49 | + |
| 50 | +### ES module way (`import`) |
| 51 | +``` javascript |
| 52 | +import NusantaraValid from './node_modules/nusantara-valid/dist/nusantara-valid.es.mjs' |
| 53 | +``` |
| 54 | + |
| 55 | +### Good-usual-way (`<script></script>`) |
| 56 | +``` html |
| 57 | +<script src="../dist/nusantara-valid.umd.js"></script> |
| 58 | +``` |
| 59 | + |
| 60 | +## API |
| 61 | + |
| 62 | +### ATM Number (Nomor Rekening) |
| 63 | +``` javascript |
| 64 | +isValidATMNumber(rek: string, bank?: string); |
| 65 | +isValidATMNumber('87.800.000.00'); |
| 66 | +isValidATMNumber('1230005123000', 'MDRK'); |
| 67 | +``` |
| 68 | + |
| 69 | +### Bank |
| 70 | +``` javascript |
| 71 | +getBankData(); |
| 72 | +``` |
| 73 | + |
| 74 | +### Cellular Number (Nomor HP) |
| 75 | +``` javascript |
| 76 | +isValidCellularNumber(cel: string); |
| 77 | +isValidCellularNumber('081212341234'); |
| 78 | +``` |
| 79 | + |
| 80 | +### Credit Card Number |
| 81 | +``` javascript |
| 82 | +isValidCCNumber(cc: string); |
| 83 | +isValidCCNumber('4000123456789010'); |
| 84 | +isValidCCNumber('5000 1234 5678 9010'); |
| 85 | + |
| 86 | +formatCCNumber(cc: string); |
| 87 | +formatCCNumber('4000123456789010'); |
| 88 | +formatCCNumber('5000 1234 5678 9010'); |
| 89 | +``` |
| 90 | + |
| 91 | +### E-Mail |
| 92 | +``` javascript |
| 93 | +isValidEmail(email: string); |
| 94 | +isValidEmail('myawesom-email@domain.tld'); |
| 95 | +``` |
| 96 | + |
| 97 | +### Nomor Induk Kependudukan (NIK) |
| 98 | +``` javascript |
| 99 | +isValidNIK(nik: string | number); |
| 100 | +isValidNIK('3101011212930001'); |
| 101 | +isValidNIK(3101011212930001); |
| 102 | +``` |
| 103 | + |
| 104 | +### Nomor Induk Pegawai Negeri Sipil (NIP) |
| 105 | +``` javascript |
| 106 | +isValidNIP(nip: string); |
| 107 | +isValidNIP('198512262000051001'); |
| 108 | +``` |
| 109 | + |
| 110 | +### Nomor Induk Siswa Nasional (NISN) |
| 111 | +``` javascript |
| 112 | +isValidNISN(nisn: string); |
| 113 | +isValidNISN('0061230001'); |
| 114 | +``` |
| 115 | + |
| 116 | +### Nomor Pokok Wajib Pajak (NPWP) |
| 117 | +``` javascript |
| 118 | +isValidNPWP(npwp: string); |
| 119 | +isValidNPWP('09.123.123.1-123.123'); |
| 120 | +isValidNPWP('091231231123123'); |
| 121 | + |
| 122 | +formatNPWP(npwp: string | number, pad?: true); // xx.xxx.xxx.x-xxx.xxx |
| 123 | +formatNPWP('091231231123123'); |
| 124 | +formatNPWP(671231231123123, false); |
| 125 | +``` |
| 126 | + |
| 127 | +### Province |
| 128 | +``` javascript |
| 129 | +getProvinceData(); |
| 130 | +``` |
| 131 | + |
| 132 | +### Tanda Nomor Kendaraan Bermotor (TNKB) |
| 133 | +``` javascript |
| 134 | +isValidTNKB(tnkb: string); |
| 135 | +isValidTNKB('AB1234XYZ'); |
| 136 | +``` |
| 137 | + |
| 138 | +### Telephone Number (Nomor Telefon) |
| 139 | +``` javascript |
| 140 | +isValidTelephoneNumber(tel: string); |
| 141 | +isValidTelephoneNumber('0274123123'); |
| 142 | +``` |
| 143 | + |
| 144 | +### ZIP Code (Kode POS) |
| 145 | +``` javascript |
| 146 | +isValidZIP(zip: string | number); |
| 147 | +isValidZIP('55524'); |
| 148 | +isValidZIP(55524); |
| 149 | +``` |
| 150 | + |
| 151 | +## Creators |
| 152 | + |
| 153 | +**Fajar Setya Budi** |
| 154 | + |
| 155 | +- <https://github.com/magicjar> |
| 156 | + |
| 157 | +## License |
| 158 | + |
| 159 | +Nusantara Valid released under the [MIT License](https://github.com/magicjar/nusantara-valid/blob/master/LICENSE) |
0 commit comments