Nusantara Valid
Nusantara Valid is a data validator to validate any Indonesian specific civil data such as nik, nip, and many more.
Baca petunjuk berbahasa Indonesia
Table of contents
What it can do?
- ATM Number (Nomor Rekening)
- Cellular Number / Mobile Number
- Credit Card Number
- E-Mail
- NIK (Nomor Induk Kependudukan)
- NIP (Nomor Induk Pegawai Negeri Sipil)
- NISN (Nomor Induk Siswa Nasional)
- NPWP (Nomor Pokok Wajib Pajak)
- TNKB (Tanda Nomor Kendaraan Bermotor)
- Telephon Number
- ZIP Code (Kode Pos)
Getting started
There are some ways to import the package
What's included
The package includes multiple formats to support different build process.
- /cjs/nusantara-valid.js - CommonJS module.
- /esm/nusantara-valid.js - ES module.
- /umd/nusantara-valid.js - UMD module. Can be used in browser with
script
tag
We provide compiled JS (nusantara-valid.js
), as well as compiled and minified JS (nusantara-valid.min.js
) in each module. Extended JS files (nusantara-valid.extended.js
and minified nusantara-valid.extended.min.js
) include additional PROVINCE_DATA such as regencies and districts also some additional verification process.
Folder structure
nusantara-valid/
└── dist/
├── cjs/
│ ├── nusantara-valid.extended.js
│ ├── nusantara-valid.extended.js.map
│ ├── nusantara-valid.extended.min.js
│ ├── nusantara-valid.extended.min.js.map
│ ├── nusantara-valid.js
│ ├── nusantara-valid.js.map
│ ├── nusantara-valid.min.js
│ └── nusantara-valid.min.js.map
├── esm/
│ ├── nusantara-valid.extended.js
│ ├── nusantara-valid.extended.js.map
│ ├── nusantara-valid.extended.min.js
│ ├── nusantara-valid.extended.min.js.map
│ ├── nusantara-valid.js
│ ├── nusantara-valid.js.map
│ ├── nusantara-valid.min.js
│ └── nusantara-valid.min.js.map
└── umd/
├── nusantara-valid.extended.js
├── nusantara-valid.extended.js.map
├── nusantara-valid.extended.min.js
├── nusantara-valid.extended.min.js.map
├── nusantara-valid.js
├── nusantara-valid.js.map
├── nusantara-valid.min.js
└── nusantara-valid.min.js.map
Usage
CommonJS module way (require()
)
const NusantaraValid = require('nusantara-valid')
ES module way (import
)
import NusantaraValid from './node_modules/nusantara-valid/dist/esm/nusantara-valid.js'
Good-old-browser-way (<script></script>
)
Local
<script src="../dist/umd/nusantara-valid.min.js"></script>
CDN
<script src="https://cdn.jsdelivr.net/npm/nusantara-valid@0.4.2/dist/umd/nusantara-valid.min.js"></script>
API
ATM Number (Nomor Rekening)
isValidATMNumber(atm: string);
isValidATMNumberWithComparison(atm: string, bankKey: string);
Result:
isValidATMNumber('87.800.000.00');
isValidATMNumberWithComparison('1230005123000', 'MDRK');
|
Bank
getDataBank(bankKey: string);
getDataBanks();
Result:
getDataBank('BCAK');
getDataBanks();
|
Cellular Number (Nomor HP)
isValidCellularNumber(cel: string);
isValidCellularNumberWithComparison(cel: string, providerKey: string);
getDataCellularNumber(cel: string);
formatCellularNumber(cel: string, int:boolean = false)
Result:
isValidCellularNumber('081212341234');
isValidCellularNumberWithComparison('081212341234', 'TELKOMSEL');
getDataCellularNumber('085612341234');
formatCellularNumber('+6281812341234');
formatCellularNumber('085612341234', true);
|
Cellular Provider
getDataCellularProvider(key: string);
getDataCellularProviders();
Result:
getDataCellularProvider('TELKOMSEL');
getDataCellularProviders();
|
Credit Card Number
isValidCCNumber(cc: string);
formatCCNumber(cc: string);
Result:
isValidCCNumber('4000123456789010');
isValidCCNumber('5000 1234 5678 9010');
formatCCNumber('4000123456789010');
formatCCNumber('5000 1234 5678 9010');
|
E-Mail
isValidEmail(email: string);
Result:
isValidEmail('myawesom-email@domain.tld');
|
Nomor Induk Kependudukan (NIK)
isValidNIK(nik: string);
isValidNIKWithComparison(nik: string, comparison: { provinceKy?: string, birthday?: string });
getDataNIK(nik: string);
Result:
isValidNIK('3101011212930001');
isValidNIKWithComparison('3101011212930001', { provinceKey: '31', birthday: '1993-12-12' });
getDataNIK('3101011212930001');
|
Nomor Induk Pegawai Negeri Sipil (NIP)
isValidNIP(nip: string);
Result:
isValidNIP('198512262000051001');
|
Nomor Induk Siswa Nasional (NISN)
isValidNISN(nisn: string);
Result:
isValidNISN('0061230001');
|
Nomor Pokok Wajib Pajak (NPWP)
isValidNPWP(npwp: string);
formatNPWP(npwp: string);
Result:
isValidNPWP('09.123.123.1-123.123');
isValidNPWP('091231231123123');
formatNPWP('091231231123123');
|
Province
getDataProvince(key: string);
getDataProvinces();
Result:
getDataProvince('34');
getDataProvinces();
|
Tanda Nomor Kendaraan Bermotor (TNKB)
isValidTNKB(tnkb: string);
getDataTNKB(tnkb: string);
Result:
isValidTNKB('AB1234XYZ');
getDataTNKB('AB1234XYZ');
|
Telephone Number (Nomor Telefon)
isValidTelephoneNumber(tel: string);
getDataTelephoneNumber(cel: string);
formatTelephoneNumber(tel: string, int:boolean = false)
Result:
isValidTelephoneNumber('0274123123');
getDataTelephoneNumber('0274123123');
formatTelephoneNumber('0274123123');
formatTelephoneNumber('0274123123', true);
|
ZIP Code (Kode POS)
isValidZIP(zip: string | number);
isValidZIPWithComparison(zip: string | number, comparison: { provinceKy?: string });
Result:
isValidZIP('55264');
isValidZIP(55264);
isValidZIPWithComparison('55264', { provinceKey: '34' });
isValidZIPWithComparison(55264, { provinceKey: '34' });
|
API (Extended Only)
Province
getDataRegenciesInProvince(provinceBPSCode: string);
getDataDistrictsInRegency(regencyBPSCode: string);
Result:
getDataRegenciesInProvince('31');
getDataDistrictsInRegency('31.71');
|
License
Copyright (c) 2020 - Fajar Setya Budi.
Nusantara Valid released under the MIT License.