-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathindex.js
28 lines (24 loc) · 875 Bytes
/
index.js
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
'use strict';
const {RawResponseHandler} = require('@rahadiana/node_response_standard')
const {nikParser} = require('@rahadiana/nik-parser')
const ParseKTP = function (nik) {
const Parse = nikParser(`${nik}`)
if (Parse.isValid() == true) {
const Resuts = {
provinceId: Parse.provinceId(),
province: Parse.province(),
kabupatenKotaId: Parse.kabupatenKotaId(),
kabupatenKota: Parse.kabupatenKota(),
kecamatanId: Parse.kecamatanId(),
kecamatan: Parse.kecamatan(),
kodepos:Parse.kodepos(),
kelamin:Parse.kelamin(),
lahir:Parse.lahir(),
uniqcode:Parse.uniqcode()
}
return RawResponseHandler(200, Resuts, 'sucess')
} else {
return RawResponseHandler(400, '', 'failed parse NIK')
}
}
module.exports = ParseKTP