@stll/stdnum 1.0.0 → 2.0.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +1 -4
- package/dist/_checksums/luhn.js.map +1 -1
- package/dist/_checksums/mod1110.js +1 -1
- package/dist/_checksums/mod1110.js.map +1 -1
- package/dist/_checksums/mod112.js.map +1 -1
- package/dist/_checksums/mod97.js.map +1 -1
- package/dist/_checksums/verhoeff.js.map +1 -1
- package/dist/_checksums/weighted-sum.js.map +1 -1
- package/dist/_util/arabic.js.map +1 -1
- package/dist/_util/clean.js.map +1 -1
- package/dist/_util/date.js.map +1 -1
- package/dist/_util/generate.js.map +1 -1
- package/dist/_util/result.js.map +1 -1
- package/dist/_util/strings.js.map +1 -1
- package/dist/ad/nrt.d.ts +16 -2
- package/dist/ad/nrt.js +1 -14
- package/dist/ad/nrt.js.map +1 -1
- package/dist/ae/eid.d.ts +2 -2
- package/dist/ae/eid.js +2 -12
- package/dist/ae/eid.js.map +1 -1
- package/dist/ai/tin.d.ts +20 -2
- package/dist/ai/tin.js +1 -18
- package/dist/ai/tin.js.map +1 -1
- package/dist/al/nipt.d.ts +13 -2
- package/dist/al/nipt.js +1 -11
- package/dist/al/nipt.js.map +1 -1
- package/dist/am/tin.d.ts +16 -2
- package/dist/am/tin.js +1 -14
- package/dist/am/tin.js.map +1 -1
- package/dist/ar/cbu.d.ts +2 -2
- package/dist/ar/cbu.js +1 -9
- package/dist/ar/cbu.js.map +1 -1
- package/dist/ar/cuit.d.ts +2 -2
- package/dist/ar/cuit.js +1 -17
- package/dist/ar/cuit.js.map +1 -1
- package/dist/ar/dni.d.ts +11 -2
- package/dist/ar/dni.js +1 -9
- package/dist/ar/dni.js.map +1 -1
- package/dist/at/businessid.d.ts +10 -2
- package/dist/at/businessid.js +1 -8
- package/dist/at/businessid.js.map +1 -1
- package/dist/at/tin.d.ts +2 -2
- package/dist/at/tin.js +1 -11
- package/dist/at/tin.js.map +1 -1
- package/dist/at/uid.d.ts +2 -2
- package/dist/at/uid.js +2 -10
- package/dist/at/uid.js.map +1 -1
- package/dist/at/vnr.d.ts +2 -2
- package/dist/at/vnr.js +4 -14
- package/dist/at/vnr.js.map +1 -1
- package/dist/au/abn.d.ts +2 -2
- package/dist/au/abn.js +1 -10
- package/dist/au/abn.js.map +1 -1
- package/dist/au/acn.d.ts +2 -2
- package/dist/au/acn.js +1 -10
- package/dist/au/acn.js.map +1 -1
- package/dist/au/tfn.d.ts +2 -2
- package/dist/au/tfn.js +1 -10
- package/dist/au/tfn.js.map +1 -1
- package/dist/az/voen.d.ts +2 -2
- package/dist/az/voen.js +1 -14
- package/dist/az/voen.js.map +1 -1
- package/dist/ba/jmbg.d.ts +2 -2
- package/dist/ba/jmbg.js +3 -11
- package/dist/ba/jmbg.js.map +1 -1
- package/dist/bd/nid.d.ts +23 -2
- package/dist/bd/nid.js +1 -21
- package/dist/bd/nid.js.map +1 -1
- package/dist/be/bis.d.ts +2 -2
- package/dist/be/bis.js +1 -11
- package/dist/be/bis.js.map +1 -1
- package/dist/be/nn.d.ts +2 -2
- package/dist/be/nn.js +1 -11
- package/dist/be/nn.js.map +1 -1
- package/dist/be/vat.d.ts +2 -2
- package/dist/be/vat.js +1 -9
- package/dist/be/vat.js.map +1 -1
- package/dist/bg/egn.d.ts +2 -2
- package/dist/bg/egn.js +3 -18
- package/dist/bg/egn.js.map +1 -1
- package/dist/bg/pnf.d.ts +2 -2
- package/dist/bg/pnf.js +1 -8
- package/dist/bg/pnf.js.map +1 -1
- package/dist/bg/vat.d.ts +2 -2
- package/dist/bg/vat.js +3 -9
- package/dist/bg/vat.js.map +1 -1
- package/dist/bh/cpr.d.ts +2 -2
- package/dist/bh/cpr.js +1 -17
- package/dist/bh/cpr.js.map +1 -1
- package/dist/bic.d.ts +13 -2
- package/dist/bic.js +1 -11
- package/dist/bic.js.map +1 -1
- package/dist/br/cnpj.d.ts +2 -2
- package/dist/br/cnpj.js +1 -20
- package/dist/br/cnpj.js.map +1 -1
- package/dist/br/cpf.d.ts +2 -2
- package/dist/br/cpf.js +1 -14
- package/dist/br/cpf.js.map +1 -1
- package/dist/by/unp.d.ts +2 -2
- package/dist/by/unp.js +3 -14
- package/dist/by/unp.js.map +1 -1
- package/dist/bz/tin.d.ts +2 -2
- package/dist/bz/tin.js +1 -26
- package/dist/bz/tin.js.map +1 -1
- package/dist/ca/bn.d.ts +2 -2
- package/dist/ca/bn.js +2 -10
- package/dist/ca/bn.js.map +1 -1
- package/dist/ca/sin.d.ts +2 -2
- package/dist/ca/sin.js +2 -10
- package/dist/ca/sin.js.map +1 -1
- package/dist/ch/ssn.d.ts +2 -2
- package/dist/ch/ssn.js +1 -9
- package/dist/ch/ssn.js.map +1 -1
- package/dist/ch/uid.d.ts +2 -2
- package/dist/ch/uid.js +1 -9
- package/dist/ch/uid.js.map +1 -1
- package/dist/ch/vat.d.ts +2 -2
- package/dist/ch/vat.js +1 -9
- package/dist/ch/vat.js.map +1 -1
- package/dist/cl/rut.d.ts +2 -2
- package/dist/cl/rut.js +1 -14
- package/dist/cl/rut.js.map +1 -1
- package/dist/cn/ric.d.ts +2 -2
- package/dist/cn/ric.js +3 -14
- package/dist/cn/ric.js.map +1 -1
- package/dist/cn/uscc.d.ts +2 -2
- package/dist/cn/uscc.js +1 -10
- package/dist/cn/uscc.js.map +1 -1
- package/dist/co/nit.d.ts +2 -2
- package/dist/co/nit.js +2 -12
- package/dist/co/nit.js.map +1 -1
- package/dist/cr/cpf.d.ts +18 -2
- package/dist/cr/cpf.js +1 -16
- package/dist/cr/cpf.js.map +1 -1
- package/dist/creditcard.d.ts +2 -2
- package/dist/creditcard.js +5 -14
- package/dist/creditcard.js.map +1 -1
- package/dist/cu/ni.d.ts +2 -2
- package/dist/cu/ni.js +2 -17
- package/dist/cu/ni.js.map +1 -1
- package/dist/cy/vat.d.ts +2 -2
- package/dist/cy/vat.js +1 -8
- package/dist/cy/vat.js.map +1 -1
- package/dist/cz/dic.d.ts +2 -2
- package/dist/cz/dic.js +7 -13
- package/dist/cz/dic.js.map +1 -1
- package/dist/cz/ico.d.ts +2 -2
- package/dist/cz/ico.js +2 -10
- package/dist/cz/ico.js.map +1 -1
- package/dist/cz/rc.d.ts +2 -2
- package/dist/cz/rc.js +2 -26
- package/dist/cz/rc.js.map +1 -1
- package/dist/de/handelsreg.d.ts +19 -2
- package/dist/de/handelsreg.js +1 -17
- package/dist/de/handelsreg.js.map +1 -1
- package/dist/de/idnr.d.ts +2 -2
- package/dist/de/idnr.js +2 -12
- package/dist/de/idnr.js.map +1 -1
- package/dist/de/stnr.d.ts +17 -2
- package/dist/de/stnr.js +1 -15
- package/dist/de/stnr.js.map +1 -1
- package/dist/de/svnr.d.ts +2 -2
- package/dist/de/svnr.js +2 -11
- package/dist/de/svnr.js.map +1 -1
- package/dist/de/vat.d.ts +2 -2
- package/dist/de/vat.js +2 -11
- package/dist/de/vat.js.map +1 -1
- package/dist/dk/cpr.d.ts +2 -2
- package/dist/dk/cpr.js +2 -10
- package/dist/dk/cpr.js.map +1 -1
- package/dist/dk/cvr.d.ts +2 -2
- package/dist/dk/cvr.js +2 -15
- package/dist/dk/cvr.js.map +1 -1
- package/dist/dk/vat.d.ts +2 -2
- package/dist/dk/vat.js +3 -13
- package/dist/dk/vat.js.map +1 -1
- package/dist/do/rnc.d.ts +2 -2
- package/dist/do/rnc.js +2 -16
- package/dist/do/rnc.js.map +1 -1
- package/dist/ec/ruc.d.ts +2 -2
- package/dist/ec/ruc.js +1 -18
- package/dist/ec/ruc.js.map +1 -1
- package/dist/ee/ik.d.ts +2 -2
- package/dist/ee/ik.js +3 -20
- package/dist/ee/ik.js.map +1 -1
- package/dist/ee/registrikood.d.ts +2 -2
- package/dist/ee/registrikood.js +1 -8
- package/dist/ee/registrikood.js.map +1 -1
- package/dist/ee/vat.d.ts +2 -2
- package/dist/ee/vat.js +2 -10
- package/dist/ee/vat.js.map +1 -1
- package/dist/eg/tn.d.ts +11 -2
- package/dist/eg/tn.js +1 -9
- package/dist/eg/tn.js.map +1 -1
- package/dist/es/cif.d.ts +2 -2
- package/dist/es/cif.js +1 -10
- package/dist/es/cif.js.map +1 -1
- package/dist/es/dni.d.ts +2 -2
- package/dist/es/dni.js +1 -9
- package/dist/es/dni.js.map +1 -1
- package/dist/es/nie.d.ts +2 -2
- package/dist/es/nie.js +1 -9
- package/dist/es/nie.js.map +1 -1
- package/dist/es/nss.d.ts +2 -2
- package/dist/es/nss.js +1 -16
- package/dist/es/nss.js.map +1 -1
- package/dist/es/vat.d.ts +2 -2
- package/dist/es/vat.js +5 -10
- package/dist/es/vat.js.map +1 -1
- package/dist/eu/vat.d.ts +2 -2
- package/dist/eu/vat.js +1 -0
- package/dist/eu/vat.js.map +1 -1
- package/dist/fi/hetu.d.ts +2 -2
- package/dist/fi/hetu.js +2 -10
- package/dist/fi/hetu.js.map +1 -1
- package/dist/fi/vat.d.ts +2 -2
- package/dist/fi/vat.js +3 -10
- package/dist/fi/vat.js.map +1 -1
- package/dist/fi/ytunnus.d.ts +2 -2
- package/dist/fi/ytunnus.js +2 -10
- package/dist/fi/ytunnus.js.map +1 -1
- package/dist/fr/nif.d.ts +2 -2
- package/dist/fr/nif.js +1 -9
- package/dist/fr/nif.js.map +1 -1
- package/dist/fr/nir.d.ts +2 -2
- package/dist/fr/nir.js +2 -14
- package/dist/fr/nir.js.map +1 -1
- package/dist/fr/siren.d.ts +2 -2
- package/dist/fr/siren.js +2 -10
- package/dist/fr/siren.js.map +1 -1
- package/dist/fr/siret.d.ts +2 -2
- package/dist/fr/siret.js +2 -11
- package/dist/fr/siret.js.map +1 -1
- package/dist/fr/tva.d.ts +2 -2
- package/dist/fr/tva.js +2 -12
- package/dist/fr/tva.js.map +1 -1
- package/dist/gb/nino.d.ts +12 -2
- package/dist/gb/nino.js +1 -10
- package/dist/gb/nino.js.map +1 -1
- package/dist/gb/sedol.d.ts +2 -2
- package/dist/gb/sedol.js +1 -11
- package/dist/gb/sedol.js.map +1 -1
- package/dist/gb/utr.d.ts +2 -2
- package/dist/gb/utr.js +2 -10
- package/dist/gb/utr.js.map +1 -1
- package/dist/gb/vat.d.ts +2 -2
- package/dist/gb/vat.js +2 -11
- package/dist/gb/vat.js.map +1 -1
- package/dist/ge/pin.d.ts +14 -2
- package/dist/ge/pin.js +1 -12
- package/dist/ge/pin.js.map +1 -1
- package/dist/gh/tin.d.ts +2 -2
- package/dist/gh/tin.js +1 -15
- package/dist/gh/tin.js.map +1 -1
- package/dist/gr/amka.d.ts +2 -2
- package/dist/gr/amka.js +3 -11
- package/dist/gr/amka.js.map +1 -1
- package/dist/gr/vat.d.ts +2 -2
- package/dist/gr/vat.js +1 -10
- package/dist/gr/vat.js.map +1 -1
- package/dist/gt/nit.d.ts +2 -2
- package/dist/gt/nit.js +1 -12
- package/dist/gt/nit.js.map +1 -1
- package/dist/hk/hkid.d.ts +2 -2
- package/dist/hk/hkid.js +1 -10
- package/dist/hk/hkid.js.map +1 -1
- package/dist/hr/vat.d.ts +2 -2
- package/dist/hr/vat.js +2 -9
- package/dist/hr/vat.js.map +1 -1
- package/dist/hu/vat.d.ts +2 -2
- package/dist/hu/vat.js +3 -10
- package/dist/hu/vat.js.map +1 -1
- package/dist/iban.d.ts +2 -2
- package/dist/iban.js +2 -8
- package/dist/iban.js.map +1 -1
- package/dist/id/npwp.d.ts +2 -2
- package/dist/id/npwp.js +3 -13
- package/dist/id/npwp.js.map +1 -1
- package/dist/ie/pps.d.ts +2 -2
- package/dist/ie/pps.js +1 -10
- package/dist/ie/pps.js.map +1 -1
- package/dist/ie/vat.d.ts +2 -2
- package/dist/ie/vat.js +1 -9
- package/dist/ie/vat.js.map +1 -1
- package/dist/il/idnr.d.ts +2 -2
- package/dist/il/idnr.js +2 -9
- package/dist/il/idnr.js.map +1 -1
- package/dist/in/aadhaar.d.ts +2 -2
- package/dist/in/aadhaar.js +2 -12
- package/dist/in/aadhaar.js.map +1 -1
- package/dist/in/gstin.d.ts +2 -2
- package/dist/in/gstin.js +1 -10
- package/dist/in/gstin.js.map +1 -1
- package/dist/in/pan.d.ts +15 -2
- package/dist/in/pan.js +1 -13
- package/dist/in/pan.js.map +1 -1
- package/dist/index.d.ts +2 -2
- package/dist/index.js +6 -6
- package/dist/iq/nid.d.ts +16 -2
- package/dist/iq/nid.js +2 -15
- package/dist/iq/nid.js.map +1 -1
- package/dist/ir/nid.d.ts +2 -2
- package/dist/ir/nid.js +2 -24
- package/dist/ir/nid.js.map +1 -1
- package/dist/is/kennitala.d.ts +2 -2
- package/dist/is/kennitala.js +2 -13
- package/dist/is/kennitala.js.map +1 -1
- package/dist/is/vsk.d.ts +9 -2
- package/dist/is/vsk.js +1 -7
- package/dist/is/vsk.js.map +1 -1
- package/dist/isin.d.ts +2 -2
- package/dist/isin.js +2 -12
- package/dist/isin.js.map +1 -1
- package/dist/it/codicefiscale.d.ts +2 -2
- package/dist/it/codicefiscale.js +1 -21
- package/dist/it/codicefiscale.js.map +1 -1
- package/dist/it/iva.d.ts +2 -2
- package/dist/it/iva.js +2 -9
- package/dist/it/iva.js.map +1 -1
- package/dist/jp/cn.d.ts +2 -2
- package/dist/jp/cn.js +1 -9
- package/dist/jp/cn.js.map +1 -1
- package/dist/jp/mynumber.d.ts +2 -2
- package/dist/jp/mynumber.js +1 -10
- package/dist/jp/mynumber.js.map +1 -1
- package/dist/kr/brn.d.ts +11 -2
- package/dist/kr/brn.js +1 -9
- package/dist/kr/brn.js.map +1 -1
- package/dist/kr/rrn.d.ts +2 -2
- package/dist/kr/rrn.js +2 -11
- package/dist/kr/rrn.js.map +1 -1
- package/dist/kw/civil.d.ts +2 -2
- package/dist/kw/civil.js +2 -14
- package/dist/kw/civil.js.map +1 -1
- package/dist/kz/iin.d.ts +2 -2
- package/dist/kz/iin.js +3 -18
- package/dist/kz/iin.js.map +1 -1
- package/dist/lei.d.ts +2 -2
- package/dist/lei.js +2 -11
- package/dist/lei.js.map +1 -1
- package/dist/li/peid.d.ts +11 -2
- package/dist/li/peid.js +1 -9
- package/dist/li/peid.js.map +1 -1
- package/dist/lk/nic.d.ts +2 -2
- package/dist/lk/nic.js +2 -14
- package/dist/lk/nic.js.map +1 -1
- package/dist/lt/asmens.d.ts +2 -2
- package/dist/lt/asmens.js +2 -1
- package/dist/lt/asmens.js.map +1 -1
- package/dist/lt/vat.d.ts +2 -2
- package/dist/lt/vat.js +2 -10
- package/dist/lt/vat.js.map +1 -1
- package/dist/lu/vat.d.ts +2 -2
- package/dist/lu/vat.js +2 -8
- package/dist/lu/vat.js.map +1 -1
- package/dist/luhn.d.ts +2 -2
- package/dist/luhn.js +2 -9
- package/dist/luhn.js.map +1 -1
- package/dist/lv/vat.d.ts +2 -2
- package/dist/lv/vat.js +2 -28
- package/dist/lv/vat.js.map +1 -1
- package/dist/ma/ice.d.ts +2 -2
- package/dist/ma/ice.js +2 -11
- package/dist/ma/ice.js.map +1 -1
- package/dist/mc/tva.d.ts +2 -2
- package/dist/mc/tva.js +1 -0
- package/dist/mc/tva.js.map +1 -1
- package/dist/md/idno.d.ts +2 -2
- package/dist/md/idno.js +1 -10
- package/dist/md/idno.js.map +1 -1
- package/dist/me/pib.d.ts +2 -2
- package/dist/me/pib.js +2 -10
- package/dist/me/pib.js.map +1 -1
- package/dist/mk/edb.d.ts +2 -2
- package/dist/mk/edb.js +2 -11
- package/dist/mk/edb.js.map +1 -1
- package/dist/mt/vat.d.ts +2 -2
- package/dist/mt/vat.js +3 -10
- package/dist/mt/vat.js.map +1 -1
- package/dist/mu/brn.d.ts +23 -2
- package/dist/mu/brn.js +1 -21
- package/dist/mu/brn.js.map +1 -1
- package/dist/mx/clabe.d.ts +2 -2
- package/dist/mx/clabe.js +1 -14
- package/dist/mx/clabe.js.map +1 -1
- package/dist/mx/curp.d.ts +2 -2
- package/dist/mx/curp.js +3 -17
- package/dist/mx/curp.js.map +1 -1
- package/dist/mx/rfc.d.ts +2 -2
- package/dist/mx/rfc.js +3 -19
- package/dist/mx/rfc.js.map +1 -1
- package/dist/my/nric.d.ts +2 -2
- package/dist/my/nric.js +2 -14
- package/dist/my/nric.js.map +1 -1
- package/dist/ng/nin.d.ts +13 -2
- package/dist/ng/nin.js +1 -11
- package/dist/ng/nin.js.map +1 -1
- package/dist/ni/ruc.d.ts +2 -2
- package/dist/ni/ruc.js +1 -23
- package/dist/ni/ruc.js.map +1 -1
- package/dist/nl/bsn.d.ts +2 -2
- package/dist/nl/bsn.js +2 -10
- package/dist/nl/bsn.js.map +1 -1
- package/dist/nl/kvk.d.ts +9 -2
- package/dist/nl/kvk.js +1 -7
- package/dist/nl/kvk.js.map +1 -1
- package/dist/nl/vat.d.ts +2 -2
- package/dist/nl/vat.js +1 -13
- package/dist/nl/vat.js.map +1 -1
- package/dist/no/fodselsnummer.d.ts +2 -2
- package/dist/no/fodselsnummer.js +2 -10
- package/dist/no/fodselsnummer.js.map +1 -1
- package/dist/no/mva.d.ts +2 -2
- package/dist/no/mva.js +1 -8
- package/dist/no/mva.js.map +1 -1
- package/dist/no/orgnr.d.ts +2 -2
- package/dist/no/orgnr.js +2 -8
- package/dist/no/orgnr.js.map +1 -1
- package/dist/nz/ird.d.ts +2 -2
- package/dist/nz/ird.js +2 -11
- package/dist/nz/ird.js.map +1 -1
- package/dist/pa/ruc.d.ts +2 -2
- package/dist/pa/ruc.js +1 -18
- package/dist/pa/ruc.js.map +1 -1
- package/dist/patterns.d.ts +8 -7
- package/dist/patterns.js +3 -5
- package/dist/patterns.js.map +1 -1
- package/dist/pe/ruc.d.ts +2 -2
- package/dist/pe/ruc.js +1 -15
- package/dist/pe/ruc.js.map +1 -1
- package/dist/ph/philid.d.ts +14 -2
- package/dist/ph/philid.js +1 -12
- package/dist/ph/philid.js.map +1 -1
- package/dist/pk/cnic.d.ts +14 -2
- package/dist/pk/cnic.js +1 -12
- package/dist/pk/cnic.js.map +1 -1
- package/dist/pl/nip.d.ts +2 -2
- package/dist/pl/nip.js +2 -10
- package/dist/pl/nip.js.map +1 -1
- package/dist/pl/pesel.d.ts +2 -2
- package/dist/pl/pesel.js +3 -13
- package/dist/pl/pesel.js.map +1 -1
- package/dist/pl/regon.d.ts +2 -2
- package/dist/pl/regon.js +2 -11
- package/dist/pl/regon.js.map +1 -1
- package/dist/pt/cc.d.ts +2 -2
- package/dist/pt/cc.js +1 -9
- package/dist/pt/cc.js.map +1 -1
- package/dist/pt/vat.d.ts +2 -2
- package/dist/pt/vat.js +3 -11
- package/dist/pt/vat.js.map +1 -1
- package/dist/ro/cnp.d.ts +2 -2
- package/dist/ro/cnp.js +4 -14
- package/dist/ro/cnp.js.map +1 -1
- package/dist/ro/vat.d.ts +2 -2
- package/dist/ro/vat.js +13 -11
- package/dist/ro/vat.js.map +1 -1
- package/dist/rs/pib.d.ts +2 -2
- package/dist/rs/pib.js +1 -9
- package/dist/rs/pib.js.map +1 -1
- package/dist/ru/inn.d.ts +2 -2
- package/dist/ru/inn.js +1 -11
- package/dist/ru/inn.js.map +1 -1
- package/dist/se/orgnr.d.ts +2 -2
- package/dist/se/orgnr.js +2 -9
- package/dist/se/orgnr.js.map +1 -1
- package/dist/se/personnummer.d.ts +2 -2
- package/dist/se/personnummer.js +7 -15
- package/dist/se/personnummer.js.map +1 -1
- package/dist/se/vat.d.ts +2 -2
- package/dist/se/vat.js +3 -10
- package/dist/se/vat.js.map +1 -1
- package/dist/sg/uen.d.ts +2 -2
- package/dist/sg/uen.js +1 -15
- package/dist/sg/uen.js.map +1 -1
- package/dist/si/emso.d.ts +2 -2
- package/dist/si/emso.js +3 -18
- package/dist/si/emso.js.map +1 -1
- package/dist/si/vat.d.ts +2 -2
- package/dist/si/vat.js +3 -12
- package/dist/si/vat.js.map +1 -1
- package/dist/sk/dic.d.ts +2 -2
- package/dist/sk/dic.js +1 -0
- package/dist/sk/dic.js.map +1 -1
- package/dist/sk/ico.d.ts +2 -2
- package/dist/sk/ico.js +1 -0
- package/dist/sk/ico.js.map +1 -1
- package/dist/sk/rc.d.ts +2 -2
- package/dist/sk/rc.js +1 -0
- package/dist/sk/rc.js.map +1 -1
- package/dist/th/tin.d.ts +2 -2
- package/dist/th/tin.js +1 -11
- package/dist/th/tin.js.map +1 -1
- package/dist/tr/tckimlik.d.ts +2 -2
- package/dist/tr/tckimlik.js +1 -20
- package/dist/tr/tckimlik.js.map +1 -1
- package/dist/tr/vkn.d.ts +2 -2
- package/dist/tr/vkn.js +1 -20
- package/dist/tr/vkn.js.map +1 -1
- package/dist/tw/ubn.d.ts +2 -2
- package/dist/tw/ubn.js +1 -11
- package/dist/tw/ubn.js.map +1 -1
- package/dist/types.d.ts +26 -4
- package/dist/ua/edrpou.d.ts +2 -2
- package/dist/ua/edrpou.js +1 -11
- package/dist/ua/edrpou.js.map +1 -1
- package/dist/us/ein.d.ts +12 -2
- package/dist/us/ein.js +1 -10
- package/dist/us/ein.js.map +1 -1
- package/dist/us/itin.d.ts +13 -2
- package/dist/us/itin.js +1 -11
- package/dist/us/itin.js.map +1 -1
- package/dist/us/rtn.d.ts +2 -2
- package/dist/us/rtn.js +3 -18
- package/dist/us/rtn.js.map +1 -1
- package/dist/us/ssn.d.ts +13 -2
- package/dist/us/ssn.js +1 -11
- package/dist/us/ssn.js.map +1 -1
- package/dist/uy/rut.d.ts +2 -2
- package/dist/uy/rut.js +1 -14
- package/dist/uy/rut.js.map +1 -1
- package/dist/ve/rif.d.ts +2 -2
- package/dist/ve/rif.js +2 -15
- package/dist/ve/rif.js.map +1 -1
- package/dist/vn/mst.d.ts +2 -2
- package/dist/vn/mst.js +1 -12
- package/dist/vn/mst.js.map +1 -1
- package/dist/za/idnr.d.ts +2 -2
- package/dist/za/idnr.js +3 -16
- package/dist/za/idnr.js.map +1 -1
- package/package.json +22 -12
- package/src/_checksums/mod1110.ts +1 -1
- package/src/ad/nrt.ts +7 -3
- package/src/ae/eid.ts +7 -3
- package/src/ai/tin.ts +7 -3
- package/src/al/nipt.ts +7 -3
- package/src/am/tin.ts +7 -3
- package/src/ar/cbu.ts +7 -3
- package/src/ar/cuit.ts +7 -3
- package/src/ar/dni.ts +7 -3
- package/src/at/businessid.ts +7 -3
- package/src/at/tin.ts +7 -3
- package/src/at/uid.ts +7 -3
- package/src/at/vnr.ts +37 -9
- package/src/au/abn.ts +7 -3
- package/src/au/acn.ts +7 -3
- package/src/au/tfn.ts +7 -3
- package/src/az/voen.ts +7 -3
- package/src/ba/jmbg.ts +8 -7
- package/src/bd/nid.ts +7 -3
- package/src/be/bis.ts +8 -4
- package/src/be/nn.ts +7 -3
- package/src/be/vat.ts +7 -3
- package/src/bg/egn.ts +8 -7
- package/src/bg/pnf.ts +7 -3
- package/src/bg/vat.ts +8 -3
- package/src/bh/cpr.ts +7 -3
- package/src/bic.ts +7 -3
- package/src/br/cnpj.ts +7 -3
- package/src/br/cpf.ts +7 -3
- package/src/by/unp.ts +10 -5
- package/src/bz/tin.ts +7 -3
- package/src/ca/bn.ts +7 -3
- package/src/ca/sin.ts +7 -3
- package/src/ch/ssn.ts +7 -3
- package/src/ch/uid.ts +7 -3
- package/src/ch/vat.ts +9 -5
- package/src/cl/rut.ts +7 -3
- package/src/cn/ric.ts +8 -7
- package/src/cn/uscc.ts +7 -3
- package/src/co/nit.ts +8 -4
- package/src/cr/cpf.ts +7 -3
- package/src/creditcard.ts +10 -6
- package/src/cu/ni.ts +8 -7
- package/src/cy/vat.ts +7 -3
- package/src/cz/dic.ts +9 -4
- package/src/cz/ico.ts +7 -3
- package/src/cz/rc.ts +8 -7
- package/src/de/handelsreg.ts +7 -3
- package/src/de/idnr.ts +7 -3
- package/src/de/stnr.ts +7 -3
- package/src/de/svnr.ts +7 -3
- package/src/de/vat.ts +7 -3
- package/src/dk/cpr.ts +8 -7
- package/src/dk/cvr.ts +7 -3
- package/src/dk/vat.ts +8 -3
- package/src/do/rnc.ts +7 -3
- package/src/ec/ruc.ts +7 -3
- package/src/ee/ik.ts +8 -7
- package/src/ee/registrikood.ts +8 -4
- package/src/ee/vat.ts +7 -3
- package/src/eg/tn.ts +7 -3
- package/src/es/cif.ts +8 -4
- package/src/es/dni.ts +7 -3
- package/src/es/nie.ts +8 -4
- package/src/es/nss.ts +7 -3
- package/src/es/vat.ts +13 -5
- package/src/eu/vat.ts +10 -6
- package/src/fi/hetu.ts +8 -7
- package/src/fi/vat.ts +8 -3
- package/src/fi/ytunnus.ts +7 -3
- package/src/fr/nif.ts +7 -3
- package/src/fr/nir.ts +8 -7
- package/src/fr/siren.ts +7 -3
- package/src/fr/siret.ts +7 -3
- package/src/fr/tva.ts +7 -3
- package/src/gb/nino.ts +7 -3
- package/src/gb/sedol.ts +7 -3
- package/src/gb/utr.ts +7 -3
- package/src/gb/vat.ts +7 -3
- package/src/ge/pin.ts +7 -3
- package/src/gh/tin.ts +7 -3
- package/src/gr/amka.ts +7 -3
- package/src/gr/vat.ts +7 -3
- package/src/gt/nit.ts +7 -3
- package/src/hk/hkid.ts +7 -3
- package/src/hr/vat.ts +7 -3
- package/src/hu/vat.ts +8 -3
- package/src/iban.ts +7 -3
- package/src/id/npwp.ts +7 -3
- package/src/ie/pps.ts +7 -3
- package/src/ie/vat.ts +7 -3
- package/src/il/idnr.ts +7 -3
- package/src/in/aadhaar.ts +7 -3
- package/src/in/gstin.ts +7 -3
- package/src/in/pan.ts +7 -3
- package/src/index.ts +3 -0
- package/src/iq/nid.ts +7 -3
- package/src/ir/nid.ts +7 -3
- package/src/is/kennitala.ts +7 -3
- package/src/is/vsk.ts +7 -3
- package/src/isin.ts +7 -3
- package/src/it/codicefiscale.ts +11 -7
- package/src/it/iva.ts +7 -3
- package/src/jp/cn.ts +7 -3
- package/src/jp/mynumber.ts +7 -3
- package/src/kr/brn.ts +7 -3
- package/src/kr/rrn.ts +8 -7
- package/src/kw/civil.ts +8 -7
- package/src/kz/iin.ts +8 -8
- package/src/lei.ts +7 -3
- package/src/li/peid.ts +7 -3
- package/src/lk/nic.ts +8 -7
- package/src/lt/asmens.ts +8 -4
- package/src/lt/vat.ts +8 -3
- package/src/lu/vat.ts +8 -3
- package/src/luhn.ts +7 -3
- package/src/lv/vat.ts +7 -3
- package/src/ma/ice.ts +7 -3
- package/src/mc/tva.ts +9 -5
- package/src/md/idno.ts +7 -3
- package/src/me/pib.ts +7 -3
- package/src/mk/edb.ts +7 -3
- package/src/mt/vat.ts +8 -3
- package/src/mu/brn.ts +7 -3
- package/src/mx/clabe.ts +7 -3
- package/src/mx/curp.ts +9 -8
- package/src/mx/rfc.ts +8 -4
- package/src/my/nric.ts +8 -7
- package/src/ng/nin.ts +7 -3
- package/src/ni/ruc.ts +7 -3
- package/src/nl/bsn.ts +7 -3
- package/src/nl/kvk.ts +7 -3
- package/src/nl/vat.ts +7 -3
- package/src/no/fodselsnummer.ts +11 -7
- package/src/no/mva.ts +9 -5
- package/src/no/orgnr.ts +7 -3
- package/src/nz/ird.ts +8 -4
- package/src/pa/ruc.ts +7 -3
- package/src/patterns.ts +49 -18
- package/src/pe/ruc.ts +7 -3
- package/src/ph/philid.ts +7 -3
- package/src/pk/cnic.ts +7 -3
- package/src/pl/nip.ts +7 -3
- package/src/pl/pesel.ts +8 -7
- package/src/pl/regon.ts +7 -3
- package/src/pt/cc.ts +7 -3
- package/src/pt/vat.ts +8 -3
- package/src/ro/cnp.ts +15 -8
- package/src/ro/vat.ts +8 -3
- package/src/rs/pib.ts +7 -3
- package/src/ru/inn.ts +7 -3
- package/src/se/orgnr.ts +7 -3
- package/src/se/personnummer.ts +35 -33
- package/src/se/vat.ts +8 -3
- package/src/sg/uen.ts +7 -3
- package/src/si/emso.ts +8 -7
- package/src/si/vat.ts +8 -3
- package/src/sk/dic.ts +8 -4
- package/src/sk/ico.ts +3 -2
- package/src/sk/rc.ts +6 -2
- package/src/th/tin.ts +7 -3
- package/src/tr/tckimlik.ts +7 -3
- package/src/tr/vkn.ts +7 -3
- package/src/tw/ubn.ts +7 -3
- package/src/types.ts +34 -3
- package/src/ua/edrpou.ts +7 -3
- package/src/us/ein.ts +7 -3
- package/src/us/itin.ts +7 -3
- package/src/us/rtn.ts +16 -8
- package/src/us/ssn.ts +7 -3
- package/src/uy/rut.ts +7 -3
- package/src/ve/rif.ts +8 -6
- package/src/vn/mst.ts +7 -3
- package/src/za/idnr.ts +8 -7
package/dist/il/idnr.d.ts
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import {
|
|
1
|
+
import { CountryValidator, ValidateResult } from "../types.js";
|
|
2
2
|
|
|
3
3
|
//#region src/il/idnr.d.ts
|
|
4
4
|
declare const compact: (value: string) => string;
|
|
@@ -7,7 +7,7 @@ declare const format: (value: string) => string;
|
|
|
7
7
|
/** Generate a random valid Israeli ID number. */
|
|
8
8
|
declare const generate: () => string;
|
|
9
9
|
/** Israeli Identity Number (Mispar Zehut). */
|
|
10
|
-
declare const idnr:
|
|
10
|
+
declare const idnr: CountryValidator<"IL">;
|
|
11
11
|
//#endregion
|
|
12
12
|
export { compact, idnr as default, format, generate, validate };
|
|
13
13
|
//# sourceMappingURL=idnr.d.ts.map
|
package/dist/il/idnr.js
CHANGED
|
@@ -1,17 +1,9 @@
|
|
|
1
|
+
import { luhnChecksum, luhnValidate } from "../_checksums/luhn.js";
|
|
1
2
|
import { clean } from "../_util/clean.js";
|
|
2
3
|
import { randomDigits } from "../_util/generate.js";
|
|
3
4
|
import { err } from "../_util/result.js";
|
|
4
|
-
import { luhnChecksum, luhnValidate } from "../_checksums/luhn.js";
|
|
5
5
|
import { isdigits } from "../_util/strings.js";
|
|
6
6
|
//#region src/il/idnr.ts
|
|
7
|
-
/**
|
|
8
|
-
* Identity Number (Mispar Zehut, מספר זהות).
|
|
9
|
-
*
|
|
10
|
-
* Israeli personal identity number. 9 digits
|
|
11
|
-
* (zero-padded) with a Luhn checksum.
|
|
12
|
-
*
|
|
13
|
-
* @see https://en.wikipedia.org/wiki/Israeli_identity_card
|
|
14
|
-
*/
|
|
15
7
|
const compact = (value) => clean(value, " -").padStart(9, "0");
|
|
16
8
|
const validate = (value) => {
|
|
17
9
|
const v = compact(value);
|
|
@@ -44,6 +36,7 @@ const idnr = {
|
|
|
44
36
|
"ID number"
|
|
45
37
|
],
|
|
46
38
|
candidatePattern: "\\d{9}",
|
|
39
|
+
scope: "country",
|
|
47
40
|
country: "IL",
|
|
48
41
|
entityType: "person",
|
|
49
42
|
compact,
|
package/dist/il/idnr.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"idnr.js","names":[],"sources":["../../src/il/idnr.ts"],"sourcesContent":["/**\n * Identity Number (Mispar Zehut, מספר זהות).\n *\n * Israeli personal identity number. 9 digits\n * (zero-padded) with a Luhn checksum.\n *\n * @see https://en.wikipedia.org/wiki/Israeli_identity_card\n */\n\nimport {\n luhnValidate,\n luhnChecksum,\n} from \"#checksums/luhn\";\nimport { clean } from \"#util/clean\";\nimport { randomDigits } from \"#util/generate\";\nimport { err } from \"#util/result\";\nimport { isdigits } from \"#util/strings\";\n\
|
|
1
|
+
{"version":3,"file":"idnr.js","names":[],"sources":["../../src/il/idnr.ts"],"sourcesContent":["/**\n * Identity Number (Mispar Zehut, מספר זהות).\n *\n * Israeli personal identity number. 9 digits\n * (zero-padded) with a Luhn checksum.\n *\n * @see https://en.wikipedia.org/wiki/Israeli_identity_card\n */\n\nimport type {\n ValidateResult,\n CountryValidator,\n} from \"../types\";\n\nimport {\n luhnValidate,\n luhnChecksum,\n} from \"#checksums/luhn\";\nimport { clean } from \"#util/clean\";\nimport { randomDigits } from \"#util/generate\";\nimport { err } from \"#util/result\";\nimport { isdigits } from \"#util/strings\";\n\nconst compact = (value: string): string =>\n clean(value, \" -\").padStart(9, \"0\");\n\nconst validate = (value: string): ValidateResult => {\n const v = compact(value);\n if (v.length > 9) {\n return err(\n \"INVALID_LENGTH\",\n \"Israeli ID must be at most 9 digits\",\n );\n }\n if (!isdigits(v) || Number(v) === 0) {\n return err(\n \"INVALID_FORMAT\",\n \"Israeli ID must contain only digits\" +\n \" and not be zero\",\n );\n }\n if (!luhnValidate(v)) {\n return err(\n \"INVALID_CHECKSUM\",\n \"Israeli ID Luhn check digit mismatch\",\n );\n }\n return { valid: true, compact: v };\n};\n\nconst format = (value: string): string => {\n const v = compact(value);\n return `${v.slice(0, -1)}-${v.slice(-1)}`;\n};\n\n/** Generate a random valid Israeli ID number. */\nconst generate = (): string => {\n const payload = randomDigits(8);\n const cs = luhnChecksum(payload + \"0\");\n return payload + String((10 - cs) % 10);\n};\n\n/** Israeli Identity Number (Mispar Zehut). */\nconst idnr: CountryValidator<\"IL\"> = {\n name: \"Israeli Identity Number\",\n localName: \"מספר זהות\",\n abbreviation: \"ת.ז.\",\n aliases: [\n \"תעודת זהות\",\n \"Teudat Zehut\",\n \"ID number\",\n ] as const,\n candidatePattern: \"\\\\d{9}\",\n scope: \"country\",\n country: \"IL\",\n entityType: \"person\",\n compact,\n format,\n validate,\n description:\n \"Israeli personal identification number\" +\n \" (Mispar Zehut)\",\n sourceUrl:\n \"https://en.wikipedia.org/wiki/Israeli_identity_card\",\n lengths: [9] as const,\n examples: [\"039337423\", \"000000018\"] as const,\n generate,\n};\n\nexport default idnr;\nexport { compact, format, validate, generate };\n"],"mappings":";;;;;;AAuBA,MAAM,WAAW,UACf,MAAM,OAAO,IAAI,EAAE,SAAS,GAAG,GAAG;AAEpC,MAAM,YAAY,UAAkC;CAClD,MAAM,IAAI,QAAQ,KAAK;CACvB,IAAI,EAAE,SAAS,GACb,OAAO,IACL,kBACA,qCACF;CAEF,IAAI,CAAC,SAAS,CAAC,KAAK,OAAO,CAAC,MAAM,GAChC,OAAO,IACL,kBACA,qDAEF;CAEF,IAAI,CAAC,aAAa,CAAC,GACjB,OAAO,IACL,oBACA,sCACF;CAEF,OAAO;EAAE,OAAO;EAAM,SAAS;CAAE;AACnC;AAEA,MAAM,UAAU,UAA0B;CACxC,MAAM,IAAI,QAAQ,KAAK;CACvB,OAAO,GAAG,EAAE,MAAM,GAAG,EAAE,EAAE,GAAG,EAAE,MAAM,EAAE;AACxC;;AAGA,MAAM,iBAAyB;CAC7B,MAAM,UAAU,aAAa,CAAC;CAC9B,MAAM,KAAK,aAAa,UAAU,GAAG;CACrC,OAAO,UAAU,QAAQ,KAAK,MAAM,EAAE;AACxC;;AAGA,MAAM,OAA+B;CACnC,MAAM;CACN,WAAW;CACX,cAAc;CACd,SAAS;EACP;EACA;EACA;CACF;CACA,kBAAkB;CAClB,OAAO;CACP,SAAS;CACT,YAAY;CACZ;CACA;CACA;CACA,aACE;CAEF,WACE;CACF,SAAS,CAAC,CAAC;CACX,UAAU,CAAC,aAAa,WAAW;CACnC;AACF"}
|
package/dist/in/aadhaar.d.ts
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import {
|
|
1
|
+
import { CountryValidator, ValidateResult } from "../types.js";
|
|
2
2
|
|
|
3
3
|
//#region src/in/aadhaar.d.ts
|
|
4
4
|
declare const compact: (value: string) => string;
|
|
@@ -7,7 +7,7 @@ declare const format: (value: string) => string;
|
|
|
7
7
|
/** Generate a random valid Aadhaar number. */
|
|
8
8
|
declare const generate: () => string;
|
|
9
9
|
/** Indian Unique Identity Number. */
|
|
10
|
-
declare const aadhaar:
|
|
10
|
+
declare const aadhaar: CountryValidator<"IN">;
|
|
11
11
|
//#endregion
|
|
12
12
|
export { compact, aadhaar as default, format, generate, validate };
|
|
13
13
|
//# sourceMappingURL=aadhaar.d.ts.map
|
package/dist/in/aadhaar.js
CHANGED
|
@@ -1,20 +1,9 @@
|
|
|
1
|
+
import { verhoeffCheckDigit, verhoeffValidate } from "../_checksums/verhoeff.js";
|
|
1
2
|
import { clean } from "../_util/clean.js";
|
|
2
3
|
import { randomDigits, randomInt } from "../_util/generate.js";
|
|
3
4
|
import { err } from "../_util/result.js";
|
|
4
5
|
import { isdigits } from "../_util/strings.js";
|
|
5
|
-
import { verhoeffCheckDigit, verhoeffValidate } from "../_checksums/verhoeff.js";
|
|
6
6
|
//#region src/in/aadhaar.ts
|
|
7
|
-
/**
|
|
8
|
-
* Aadhaar (Indian unique identity number).
|
|
9
|
-
*
|
|
10
|
-
* 12 digits with Verhoeff checksum (last digit).
|
|
11
|
-
* Cannot start with 0 or 1.
|
|
12
|
-
* Issued by the Unique Identification Authority
|
|
13
|
-
* of India (UIDAI).
|
|
14
|
-
*
|
|
15
|
-
* @see https://en.wikipedia.org/wiki/Aadhaar
|
|
16
|
-
* @see https://uidai.gov.in/
|
|
17
|
-
*/
|
|
18
7
|
const compact = (value) => clean(value, " -");
|
|
19
8
|
const validate = (value) => {
|
|
20
9
|
const v = compact(value);
|
|
@@ -44,6 +33,7 @@ const aadhaar = {
|
|
|
44
33
|
abbreviation: "Aadhaar",
|
|
45
34
|
aliases: ["Aadhaar", "आधार"],
|
|
46
35
|
candidatePattern: "\\d{4}\\s?\\d{4}\\s?\\d{4}",
|
|
36
|
+
scope: "country",
|
|
47
37
|
country: "IN",
|
|
48
38
|
entityType: "person",
|
|
49
39
|
lengths: [12],
|
package/dist/in/aadhaar.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"aadhaar.js","names":[],"sources":["../../src/in/aadhaar.ts"],"sourcesContent":["/**\n * Aadhaar (Indian unique identity number).\n *\n * 12 digits with Verhoeff checksum (last digit).\n * Cannot start with 0 or 1.\n * Issued by the Unique Identification Authority\n * of India (UIDAI).\n *\n * @see https://en.wikipedia.org/wiki/Aadhaar\n * @see https://uidai.gov.in/\n */\n\nimport {\n verhoeffValidate,\n verhoeffCheckDigit,\n} from \"#checksums/verhoeff\";\nimport { clean } from \"#util/clean\";\nimport { randomDigits, randomInt } from \"#util/generate\";\nimport { err } from \"#util/result\";\nimport { isdigits } from \"#util/strings\";\n\
|
|
1
|
+
{"version":3,"file":"aadhaar.js","names":[],"sources":["../../src/in/aadhaar.ts"],"sourcesContent":["/**\n * Aadhaar (Indian unique identity number).\n *\n * 12 digits with Verhoeff checksum (last digit).\n * Cannot start with 0 or 1.\n * Issued by the Unique Identification Authority\n * of India (UIDAI).\n *\n * @see https://en.wikipedia.org/wiki/Aadhaar\n * @see https://uidai.gov.in/\n */\n\nimport type {\n ValidateResult,\n CountryValidator,\n} from \"../types\";\n\nimport {\n verhoeffValidate,\n verhoeffCheckDigit,\n} from \"#checksums/verhoeff\";\nimport { clean } from \"#util/clean\";\nimport { randomDigits, randomInt } from \"#util/generate\";\nimport { err } from \"#util/result\";\nimport { isdigits } from \"#util/strings\";\n\nconst compact = (value: string): string =>\n clean(value, \" -\");\n\nconst validate = (value: string): ValidateResult => {\n const v = compact(value);\n if (v.length !== 12) {\n return err(\n \"INVALID_LENGTH\",\n \"Aadhaar must be 12 digits\",\n );\n }\n if (!isdigits(v)) {\n return err(\n \"INVALID_FORMAT\",\n \"Aadhaar must contain only digits\",\n );\n }\n if (v[0] === \"0\" || v[0] === \"1\") {\n return err(\n \"INVALID_COMPONENT\",\n \"Aadhaar cannot start with 0 or 1\",\n );\n }\n // Aadhaar cannot be a palindrome\n if (v === v.split(\"\").reverse().join(\"\")) {\n return err(\n \"INVALID_FORMAT\",\n \"Aadhaar cannot be a palindrome\",\n );\n }\n if (!verhoeffValidate(v)) {\n return err(\n \"INVALID_CHECKSUM\",\n \"Aadhaar check digit mismatch\",\n );\n }\n return { valid: true, compact: v };\n};\n\nconst format = (value: string): string => {\n const v = compact(value);\n return `${v.slice(0, 4)} ${v.slice(4, 8)} ${v.slice(8)}`;\n};\n\n/** Generate a random valid Aadhaar number. */\nconst generate = (): string => {\n const first = String(randomInt(2, 9));\n const payload = first + randomDigits(10);\n return payload + String(verhoeffCheckDigit(payload));\n};\n\n/** Indian Unique Identity Number. */\nconst aadhaar: CountryValidator<\"IN\"> = {\n name: \"Indian Unique Identity Number\",\n localName: \"Aadhaar\",\n abbreviation: \"Aadhaar\",\n aliases: [\"Aadhaar\", \"आधार\"] as const,\n candidatePattern: \"\\\\d{4}\\\\s?\\\\d{4}\\\\s?\\\\d{4}\",\n scope: \"country\",\n country: \"IN\",\n entityType: \"person\",\n lengths: [12],\n examples: [\"234123412346\", \"295274982189\"],\n description:\n \"12-digit unique identity number issued by UIDAI\",\n sourceUrl: \"https://uidai.gov.in/\",\n compact,\n format,\n validate,\n generate,\n};\n\nexport default aadhaar;\nexport { compact, format, validate, generate };\n"],"mappings":";;;;;;AA0BA,MAAM,WAAW,UACf,MAAM,OAAO,IAAI;AAEnB,MAAM,YAAY,UAAkC;CAClD,MAAM,IAAI,QAAQ,KAAK;CACvB,IAAI,EAAE,WAAW,IACf,OAAO,IACL,kBACA,2BACF;CAEF,IAAI,CAAC,SAAS,CAAC,GACb,OAAO,IACL,kBACA,kCACF;CAEF,IAAI,EAAE,OAAO,OAAO,EAAE,OAAO,KAC3B,OAAO,IACL,qBACA,kCACF;CAGF,IAAI,MAAM,EAAE,MAAM,EAAE,EAAE,QAAQ,EAAE,KAAK,EAAE,GACrC,OAAO,IACL,kBACA,gCACF;CAEF,IAAI,CAAC,iBAAiB,CAAC,GACrB,OAAO,IACL,oBACA,8BACF;CAEF,OAAO;EAAE,OAAO;EAAM,SAAS;CAAE;AACnC;AAEA,MAAM,UAAU,UAA0B;CACxC,MAAM,IAAI,QAAQ,KAAK;CACvB,OAAO,GAAG,EAAE,MAAM,GAAG,CAAC,EAAE,GAAG,EAAE,MAAM,GAAG,CAAC,EAAE,GAAG,EAAE,MAAM,CAAC;AACvD;;AAGA,MAAM,iBAAyB;CAE7B,MAAM,UADQ,OAAO,UAAU,GAAG,CAAC,CACf,IAAI,aAAa,EAAE;CACvC,OAAO,UAAU,OAAO,mBAAmB,OAAO,CAAC;AACrD;;AAGA,MAAM,UAAkC;CACtC,MAAM;CACN,WAAW;CACX,cAAc;CACd,SAAS,CAAC,WAAW,MAAM;CAC3B,kBAAkB;CAClB,OAAO;CACP,SAAS;CACT,YAAY;CACZ,SAAS,CAAC,EAAE;CACZ,UAAU,CAAC,gBAAgB,cAAc;CACzC,aACE;CACF,WAAW;CACX;CACA;CACA;CACA;AACF"}
|
package/dist/in/gstin.d.ts
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import {
|
|
1
|
+
import { CountryValidator, ValidateResult } from "../types.js";
|
|
2
2
|
|
|
3
3
|
//#region src/in/gstin.d.ts
|
|
4
4
|
declare const compact: (value: string) => string;
|
|
@@ -7,7 +7,7 @@ declare const format: (value: string) => string;
|
|
|
7
7
|
/** Generate a random valid GSTIN. */
|
|
8
8
|
declare const generate: () => string;
|
|
9
9
|
/** Indian Goods and Services Tax ID. */
|
|
10
|
-
declare const gstin:
|
|
10
|
+
declare const gstin: CountryValidator<"IN">;
|
|
11
11
|
//#endregion
|
|
12
12
|
export { compact, gstin as default, format, generate, validate };
|
|
13
13
|
//# sourceMappingURL=gstin.d.ts.map
|
package/dist/in/gstin.js
CHANGED
|
@@ -3,16 +3,6 @@ import { randomDigits, randomInt } from "../_util/generate.js";
|
|
|
3
3
|
import { err } from "../_util/result.js";
|
|
4
4
|
import { charValue } from "../_util/strings.js";
|
|
5
5
|
//#region src/in/gstin.ts
|
|
6
|
-
/**
|
|
7
|
-
* GSTIN (Goods and Services Tax Identification
|
|
8
|
-
* Number, India).
|
|
9
|
-
*
|
|
10
|
-
* 15 characters: 2-digit state code + 10-char PAN +
|
|
11
|
-
* 1 entity number (1-9, A-Z) + "Z" + 1 check digit.
|
|
12
|
-
* Check digit uses the Luhn mod 36 algorithm.
|
|
13
|
-
*
|
|
14
|
-
* @see https://en.wikipedia.org/wiki/Goods_and_Services_Tax_Identification_Number
|
|
15
|
-
*/
|
|
16
6
|
const GSTIN_RE = /^[0-9]{2}[A-Z]{5}[0-9]{4}[A-Z][0-9A-Z]Z[0-9A-Z]$/;
|
|
17
7
|
/** Valid Indian state/UT codes: 01-37. */
|
|
18
8
|
const VALID_STATE_CODES = new Set([
|
|
@@ -115,6 +105,7 @@ const gstin = {
|
|
|
115
105
|
abbreviation: "GSTIN",
|
|
116
106
|
aliases: ["GSTIN", "GST number"],
|
|
117
107
|
candidatePattern: "\\d{2}[A-Z]{5}\\d{4}[A-Z][A-Z\\d][Z][A-Z\\d]",
|
|
108
|
+
scope: "country",
|
|
118
109
|
country: "IN",
|
|
119
110
|
entityType: "company",
|
|
120
111
|
lengths: [15],
|
package/dist/in/gstin.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"gstin.js","names":[],"sources":["../../src/in/gstin.ts"],"sourcesContent":["/**\n * GSTIN (Goods and Services Tax Identification\n * Number, India).\n *\n * 15 characters: 2-digit state code + 10-char PAN +\n * 1 entity number (1-9, A-Z) + \"Z\" + 1 check digit.\n * Check digit uses the Luhn mod 36 algorithm.\n *\n * @see https://en.wikipedia.org/wiki/Goods_and_Services_Tax_Identification_Number\n */\n\nimport { clean } from \"#util/clean\";\nimport { randomDigits, randomInt } from \"#util/generate\";\nimport { err } from \"#util/result\";\nimport { charValue } from \"#util/strings\";\n\
|
|
1
|
+
{"version":3,"file":"gstin.js","names":[],"sources":["../../src/in/gstin.ts"],"sourcesContent":["/**\n * GSTIN (Goods and Services Tax Identification\n * Number, India).\n *\n * 15 characters: 2-digit state code + 10-char PAN +\n * 1 entity number (1-9, A-Z) + \"Z\" + 1 check digit.\n * Check digit uses the Luhn mod 36 algorithm.\n *\n * @see https://en.wikipedia.org/wiki/Goods_and_Services_Tax_Identification_Number\n */\n\nimport type {\n ValidateResult,\n CountryValidator,\n} from \"../types\";\n\nimport { clean } from \"#util/clean\";\nimport { randomDigits, randomInt } from \"#util/generate\";\nimport { err } from \"#util/result\";\nimport { charValue } from \"#util/strings\";\n\nconst GSTIN_RE =\n /^[0-9]{2}[A-Z]{5}[0-9]{4}[A-Z][0-9A-Z]Z[0-9A-Z]$/;\n\n/** Valid Indian state/UT codes: 01-37. */\nconst VALID_STATE_CODES = new Set([\n \"01\",\n \"02\",\n \"03\",\n \"04\",\n \"05\",\n \"06\",\n \"07\",\n \"08\",\n \"09\",\n \"10\",\n \"11\",\n \"12\",\n \"13\",\n \"14\",\n \"15\",\n \"16\",\n \"17\",\n \"18\",\n \"19\",\n \"20\",\n \"21\",\n \"22\",\n \"23\",\n \"24\",\n \"25\",\n \"26\",\n \"27\",\n \"28\",\n \"29\",\n \"30\",\n \"31\",\n \"32\",\n \"33\",\n \"34\",\n \"35\",\n \"36\",\n \"37\",\n]);\n\nconst BASE = 36;\n\n/**\n * Luhn mod 36 checksum over the full GSTIN.\n * Returns 0 for a valid number.\n */\nconst luhn36Checksum = (value: string): number => {\n let sum = 0;\n let double = false;\n for (let i = value.length - 1; i >= 0; i--) {\n const ch = value[i];\n if (ch === undefined) continue;\n let v = charValue(ch);\n if (double) {\n v *= 2;\n sum += Math.floor(v / BASE) + (v % BASE);\n } else {\n sum += v;\n }\n double = !double;\n }\n return sum % BASE;\n};\n\nconst compact = (value: string): string =>\n clean(value, \" -\").toUpperCase();\n\nconst validate = (value: string): ValidateResult => {\n const v = compact(value);\n if (v.length !== 15) {\n return err(\n \"INVALID_LENGTH\",\n \"GSTIN must be 15 characters\",\n );\n }\n if (!GSTIN_RE.test(v)) {\n return err(\"INVALID_FORMAT\", \"GSTIN format is invalid\");\n }\n const stateCode = v.slice(0, 2);\n if (!VALID_STATE_CODES.has(stateCode)) {\n return err(\n \"INVALID_COMPONENT\",\n \"GSTIN state code is invalid\",\n );\n }\n if (v[12] === \"0\") {\n return err(\n \"INVALID_COMPONENT\",\n \"GSTIN entity number cannot be 0\",\n );\n }\n if (luhn36Checksum(v) !== 0) {\n return err(\n \"INVALID_CHECKSUM\",\n \"GSTIN check digit mismatch\",\n );\n }\n return { valid: true, compact: v };\n};\n\nconst format = (value: string): string => compact(value);\n\n/** Generate a random valid GSTIN. */\nconst generate = (): string => {\n for (;;) {\n const state = String(randomInt(1, 37)).padStart(2, \"0\");\n let pan = \"\";\n for (let i = 0; i < 5; i++)\n pan += String.fromCharCode(65 + randomInt(0, 25));\n pan +=\n randomDigits(4) +\n String.fromCharCode(65 + randomInt(0, 25));\n const entity = String(randomInt(1, 9));\n const partial = state + pan + entity + \"Z\";\n for (let d = 0; d <= 9; d++) {\n const c = partial + String(d);\n if (validate(c).valid) return c;\n }\n for (let c = 65; c <= 90; c++) {\n const cand = partial + String.fromCharCode(c);\n if (validate(cand).valid) return cand;\n }\n }\n};\n\n/** Indian Goods and Services Tax ID. */\nconst gstin: CountryValidator<\"IN\"> = {\n name: \"Indian Goods and Services Tax ID\",\n localName: \"Goods and Services Tax Identification Number\",\n abbreviation: \"GSTIN\",\n aliases: [\"GSTIN\", \"GST number\"] as const,\n candidatePattern:\n \"\\\\d{2}[A-Z]{5}\\\\d{4}[A-Z][A-Z\\\\d][Z][A-Z\\\\d]\",\n scope: \"country\",\n country: \"IN\",\n entityType: \"company\",\n lengths: [15],\n examples: [\"27AAPFU0939F1ZV\", \"29AAGCB7383J1Z4\"],\n description:\n \"15-character tax identifier for GST-registered businesses\",\n sourceUrl:\n \"https://en.wikipedia.org/wiki/Goods_and_Services_Tax_Identification_Number\",\n compact,\n format,\n validate,\n generate,\n};\n\nexport default gstin;\nexport { compact, format, validate, generate };\n"],"mappings":";;;;;AAqBA,MAAM,WACJ;;AAGF,MAAM,oBAAoB,IAAI,IAAI;CAChC;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;AACF,CAAC;AAED,MAAM,OAAO;;;;;AAMb,MAAM,kBAAkB,UAA0B;CAChD,IAAI,MAAM;CACV,IAAI,SAAS;CACb,KAAK,IAAI,IAAI,MAAM,SAAS,GAAG,KAAK,GAAG,KAAK;EAC1C,MAAM,KAAK,MAAM;EACjB,IAAI,OAAO,KAAA,GAAW;EACtB,IAAI,IAAI,UAAU,EAAE;EACpB,IAAI,QAAQ;GACV,KAAK;GACL,OAAO,KAAK,MAAM,IAAI,IAAI,IAAK,IAAI;EACrC,OACE,OAAO;EAET,SAAS,CAAC;CACZ;CACA,OAAO,MAAM;AACf;AAEA,MAAM,WAAW,UACf,MAAM,OAAO,IAAI,EAAE,YAAY;AAEjC,MAAM,YAAY,UAAkC;CAClD,MAAM,IAAI,QAAQ,KAAK;CACvB,IAAI,EAAE,WAAW,IACf,OAAO,IACL,kBACA,6BACF;CAEF,IAAI,CAAC,SAAS,KAAK,CAAC,GAClB,OAAO,IAAI,kBAAkB,yBAAyB;CAExD,MAAM,YAAY,EAAE,MAAM,GAAG,CAAC;CAC9B,IAAI,CAAC,kBAAkB,IAAI,SAAS,GAClC,OAAO,IACL,qBACA,6BACF;CAEF,IAAI,EAAE,QAAQ,KACZ,OAAO,IACL,qBACA,iCACF;CAEF,IAAI,eAAe,CAAC,MAAM,GACxB,OAAO,IACL,oBACA,4BACF;CAEF,OAAO;EAAE,OAAO;EAAM,SAAS;CAAE;AACnC;AAEA,MAAM,UAAU,UAA0B,QAAQ,KAAK;;AAGvD,MAAM,iBAAyB;CAC7B,SAAS;EACP,MAAM,QAAQ,OAAO,UAAU,GAAG,EAAE,CAAC,EAAE,SAAS,GAAG,GAAG;EACtD,IAAI,MAAM;EACV,KAAK,IAAI,IAAI,GAAG,IAAI,GAAG,KACrB,OAAO,OAAO,aAAa,KAAK,UAAU,GAAG,EAAE,CAAC;EAClD,OACE,aAAa,CAAC,IACd,OAAO,aAAa,KAAK,UAAU,GAAG,EAAE,CAAC;EAC3C,MAAM,SAAS,OAAO,UAAU,GAAG,CAAC,CAAC;EACrC,MAAM,UAAU,QAAQ,MAAM,SAAS;EACvC,KAAK,IAAI,IAAI,GAAG,KAAK,GAAG,KAAK;GAC3B,MAAM,IAAI,UAAU,OAAO,CAAC;GAC5B,IAAI,SAAS,CAAC,EAAE,OAAO,OAAO;EAChC;EACA,KAAK,IAAI,IAAI,IAAI,KAAK,IAAI,KAAK;GAC7B,MAAM,OAAO,UAAU,OAAO,aAAa,CAAC;GAC5C,IAAI,SAAS,IAAI,EAAE,OAAO,OAAO;EACnC;CACF;AACF;;AAGA,MAAM,QAAgC;CACpC,MAAM;CACN,WAAW;CACX,cAAc;CACd,SAAS,CAAC,SAAS,YAAY;CAC/B,kBACE;CACF,OAAO;CACP,SAAS;CACT,YAAY;CACZ,SAAS,CAAC,EAAE;CACZ,UAAU,CAAC,mBAAmB,iBAAiB;CAC/C,aACE;CACF,WACE;CACF;CACA;CACA;CACA;AACF"}
|
package/dist/in/pan.d.ts
CHANGED
|
@@ -1,13 +1,26 @@
|
|
|
1
|
-
import {
|
|
1
|
+
import { CountryValidator, ValidateResult } from "../types.js";
|
|
2
2
|
|
|
3
3
|
//#region src/in/pan.d.ts
|
|
4
4
|
/** Generate a random valid Indian PAN. */
|
|
5
5
|
declare const generate: () => string;
|
|
6
|
+
/**
|
|
7
|
+
* PAN (Permanent Account Number, Indian tax ID).
|
|
8
|
+
*
|
|
9
|
+
* 10 characters: 5 letters + 4 digits + 1 letter.
|
|
10
|
+
* The 4th letter encodes the holder type
|
|
11
|
+
* (P=person, C=company, H=HUF, A=AOP, B=BOI,
|
|
12
|
+
* G=government, J=AJP, L=local authority, F=FOP,
|
|
13
|
+
* T=trust). The 5th letter is the first letter
|
|
14
|
+
* of the surname or entity name.
|
|
15
|
+
* No checksum; format validation only.
|
|
16
|
+
*
|
|
17
|
+
* @see https://en.wikipedia.org/wiki/Permanent_account_number
|
|
18
|
+
*/
|
|
6
19
|
declare const compact: (value: string) => string;
|
|
7
20
|
declare const validate: (value: string) => ValidateResult;
|
|
8
21
|
declare const format: (value: string) => string;
|
|
9
22
|
/** Indian Permanent Account Number. */
|
|
10
|
-
declare const pan:
|
|
23
|
+
declare const pan: CountryValidator<"IN">;
|
|
11
24
|
//#endregion
|
|
12
25
|
export { compact, pan as default, format, generate, validate };
|
|
13
26
|
//# sourceMappingURL=pan.d.ts.map
|
package/dist/in/pan.js
CHANGED
|
@@ -2,19 +2,6 @@ import { clean } from "../_util/clean.js";
|
|
|
2
2
|
import { randomChar, randomDigits, randomInt } from "../_util/generate.js";
|
|
3
3
|
import { err } from "../_util/result.js";
|
|
4
4
|
//#region src/in/pan.ts
|
|
5
|
-
/**
|
|
6
|
-
* PAN (Permanent Account Number, Indian tax ID).
|
|
7
|
-
*
|
|
8
|
-
* 10 characters: 5 letters + 4 digits + 1 letter.
|
|
9
|
-
* The 4th letter encodes the holder type
|
|
10
|
-
* (P=person, C=company, H=HUF, A=AOP, B=BOI,
|
|
11
|
-
* G=government, J=AJP, L=local authority, F=FOP,
|
|
12
|
-
* T=trust). The 5th letter is the first letter
|
|
13
|
-
* of the surname or entity name.
|
|
14
|
-
* No checksum; format validation only.
|
|
15
|
-
*
|
|
16
|
-
* @see https://en.wikipedia.org/wiki/Permanent_account_number
|
|
17
|
-
*/
|
|
18
5
|
/** Generate a random valid Indian PAN. */
|
|
19
6
|
const generate = () => {
|
|
20
7
|
const randomLetter = () => String.fromCodePoint(65 + randomInt(0, 25));
|
|
@@ -41,6 +28,7 @@ const pan = {
|
|
|
41
28
|
abbreviation: "PAN",
|
|
42
29
|
aliases: ["PAN", "Permanent Account Number"],
|
|
43
30
|
candidatePattern: "[A-Z]{5}\\d{4}[A-Z]",
|
|
31
|
+
scope: "country",
|
|
44
32
|
country: "IN",
|
|
45
33
|
entityType: "any",
|
|
46
34
|
lengths: [10],
|
package/dist/in/pan.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"pan.js","names":[],"sources":["../../src/in/pan.ts"],"sourcesContent":["/** Generate a random valid Indian PAN. */\nconst generate = (): string => {\n const randomLetter = (): string =>\n String.fromCodePoint(65 + randomInt(0, 25));\n const first3 =\n randomLetter() + randomLetter() + randomLetter();\n const holderType = randomChar(HOLDER_TYPES);\n const fifth = randomLetter();\n const digits = randomDigits(4);\n const last = randomLetter();\n return `${first3}${holderType}${fifth}${digits}${last}`;\n};\n\n/**\n * PAN (Permanent Account Number, Indian tax ID).\n *\n * 10 characters: 5 letters + 4 digits + 1 letter.\n * The 4th letter encodes the holder type\n * (P=person, C=company, H=HUF, A=AOP, B=BOI,\n * G=government, J=AJP, L=local authority, F=FOP,\n * T=trust). The 5th letter is the first letter\n * of the surname or entity name.\n * No checksum; format validation only.\n *\n * @see https://en.wikipedia.org/wiki/Permanent_account_number\n */\n\nimport { clean } from \"#util/clean\";\nimport {\n randomChar,\n randomDigits,\n randomInt,\n} from \"#util/generate\";\nimport { err } from \"#util/result\";\n\
|
|
1
|
+
{"version":3,"file":"pan.js","names":[],"sources":["../../src/in/pan.ts"],"sourcesContent":["/** Generate a random valid Indian PAN. */\nconst generate = (): string => {\n const randomLetter = (): string =>\n String.fromCodePoint(65 + randomInt(0, 25));\n const first3 =\n randomLetter() + randomLetter() + randomLetter();\n const holderType = randomChar(HOLDER_TYPES);\n const fifth = randomLetter();\n const digits = randomDigits(4);\n const last = randomLetter();\n return `${first3}${holderType}${fifth}${digits}${last}`;\n};\n\n/**\n * PAN (Permanent Account Number, Indian tax ID).\n *\n * 10 characters: 5 letters + 4 digits + 1 letter.\n * The 4th letter encodes the holder type\n * (P=person, C=company, H=HUF, A=AOP, B=BOI,\n * G=government, J=AJP, L=local authority, F=FOP,\n * T=trust). The 5th letter is the first letter\n * of the surname or entity name.\n * No checksum; format validation only.\n *\n * @see https://en.wikipedia.org/wiki/Permanent_account_number\n */\n\nimport type {\n ValidateResult,\n CountryValidator,\n} from \"../types\";\n\nimport { clean } from \"#util/clean\";\nimport {\n randomChar,\n randomDigits,\n randomInt,\n} from \"#util/generate\";\nimport { err } from \"#util/result\";\n\nconst PAN_RE = /^[A-Z]{5}\\d{4}[A-Z]$/;\n\nconst HOLDER_TYPES = \"ABCFGHJLPT\";\n\nconst compact = (value: string): string =>\n clean(value, \" -\").toUpperCase();\n\nconst validate = (value: string): ValidateResult => {\n const v = compact(value);\n if (v.length !== 10) {\n return err(\n \"INVALID_LENGTH\",\n \"PAN must be 10 characters\",\n );\n }\n if (!PAN_RE.test(v)) {\n return err(\n \"INVALID_FORMAT\",\n \"PAN must be 5 letters + 4 digits + 1 letter\",\n );\n }\n // SAFETY: regex above guarantees v.length === 10.\n // eslint-disable-next-line no-non-null-assertion\n if (!HOLDER_TYPES.includes(v[3]!)) {\n return err(\n \"INVALID_COMPONENT\",\n \"PAN 4th character must be a valid holder type\",\n );\n }\n return { valid: true, compact: v };\n};\n\nconst format = (value: string): string => compact(value);\n\n/** Indian Permanent Account Number. */\nconst pan: CountryValidator<\"IN\"> = {\n name: \"Indian Permanent Account Number\",\n localName: \"Permanent Account Number\",\n abbreviation: \"PAN\",\n aliases: [\"PAN\", \"Permanent Account Number\"] as const,\n candidatePattern: \"[A-Z]{5}\\\\d{4}[A-Z]\",\n scope: \"country\",\n country: \"IN\",\n entityType: \"any\",\n lengths: [10],\n examples: [\"ABCPP1234C\", \"AAACR5055K\"],\n description: \"10-character alphanumeric tax identifier\",\n sourceUrl:\n \"https://en.wikipedia.org/wiki/Permanent_account_number\",\n compact,\n format,\n validate,\n generate,\n};\n\nexport default pan;\nexport { compact, format, validate, generate };\n"],"mappings":";;;;;AACA,MAAM,iBAAyB;CAC7B,MAAM,qBACJ,OAAO,cAAc,KAAK,UAAU,GAAG,EAAE,CAAC;CAO5C,OAAO,GALL,aAAa,IAAI,aAAa,IAAI,aAAa,IAC9B,WAAW,YAIF,IAHd,aAGsB,IAFrB,aAAa,CAEiB,IADhC,aACuC;AACtD;AA6BA,MAAM,SAAS;AAEf,MAAM,eAAe;AAErB,MAAM,WAAW,UACf,MAAM,OAAO,IAAI,EAAE,YAAY;AAEjC,MAAM,YAAY,UAAkC;CAClD,MAAM,IAAI,QAAQ,KAAK;CACvB,IAAI,EAAE,WAAW,IACf,OAAO,IACL,kBACA,2BACF;CAEF,IAAI,CAAC,OAAO,KAAK,CAAC,GAChB,OAAO,IACL,kBACA,6CACF;CAIF,IAAI,CAAC,aAAa,SAAS,EAAE,EAAG,GAC9B,OAAO,IACL,qBACA,+CACF;CAEF,OAAO;EAAE,OAAO;EAAM,SAAS;CAAE;AACnC;AAEA,MAAM,UAAU,UAA0B,QAAQ,KAAK;;AAGvD,MAAM,MAA8B;CAClC,MAAM;CACN,WAAW;CACX,cAAc;CACd,SAAS,CAAC,OAAO,0BAA0B;CAC3C,kBAAkB;CAClB,OAAO;CACP,SAAS;CACT,YAAY;CACZ,SAAS,CAAC,EAAE;CACZ,UAAU,CAAC,cAAc,YAAY;CACrC,aAAa;CACb,WACE;CACF;CACA;CACA;CACA;AACF"}
|
package/dist/index.d.ts
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { CountryCode, ErrorCode, ParsableValidator, ParsedBirthDate, ParsedIdentifier, ParsedPersonId, StdnumError, ValidateResult, Validator } from "./types.js";
|
|
1
|
+
import { CountryCode, CountryValidator, ErrorCode, GlobalValidator, ParsableValidator, ParsedBirthDate, ParsedIdentifier, ParsedPersonId, StdnumError, ValidateResult, Validator, ValidatorScope } from "./types.js";
|
|
2
2
|
import { mod_d_exports } from "./ad/mod.js";
|
|
3
3
|
import { mod_d_exports as mod_d_exports$1 } from "./ae/mod.js";
|
|
4
4
|
import { mod_d_exports as mod_d_exports$2 } from "./ai/mod.js";
|
|
@@ -102,4 +102,4 @@ import { mod_d_exports as mod_d_exports$93 } from "./uy/mod.js";
|
|
|
102
102
|
import { mod_d_exports as mod_d_exports$94 } from "./ve/mod.js";
|
|
103
103
|
import { mod_d_exports as mod_d_exports$95 } from "./vn/mod.js";
|
|
104
104
|
import { mod_d_exports as mod_d_exports$96 } from "./za/mod.js";
|
|
105
|
-
export { type CardNetwork, type CountryCode, type ErrorCode, type ParsableValidator, type ParsedBirthDate, type ParsedIdentifier, type ParsedPersonId, type StdnumError, type ValidateResult, type Validator, mod_d_exports as ad, mod_d_exports$1 as ae, mod_d_exports$2 as ai, mod_d_exports$3 as al, mod_d_exports$4 as am, mod_d_exports$5 as ar, mod_d_exports$6 as at, mod_d_exports$7 as au, mod_d_exports$8 as az, mod_d_exports$9 as ba, mod_d_exports$10 as bd, mod_d_exports$11 as be, mod_d_exports$12 as bg, mod_d_exports$13 as bh, bic, mod_d_exports$14 as br, mod_d_exports$15 as by, mod_d_exports$16 as bz, mod_d_exports$17 as ca, mod_d_exports$18 as ch, mod_d_exports$19 as cl, mod_d_exports$20 as cn, mod_d_exports$21 as co, mod_d_exports$22 as cr, creditCard as creditcard, mod_d_exports$23 as cu, mod_d_exports$24 as cy, mod_d_exports$25 as cz, mod_d_exports$26 as de, detectNetwork, mod_d_exports$27 as dk, mod_d_exports$28 as do_, mod_d_exports$29 as ec, mod_d_exports$30 as ee, mod_d_exports$31 as eg, mod_d_exports$32 as es, mod_d_exports$33 as eu, mod_d_exports$34 as fi, mod_d_exports$35 as fr, mod_d_exports$36 as gb, mod_d_exports$37 as ge, mod_d_exports$38 as gh, mod_d_exports$39 as gr, mod_d_exports$40 as gt, mod_d_exports$41 as hk, mod_d_exports$42 as hr, mod_d_exports$43 as hu, iban, mod_d_exports$44 as id, mod_d_exports$45 as ie, mod_d_exports$46 as il, mod_d_exports$47 as in_, mod_d_exports$48 as iq, mod_d_exports$49 as ir, mod_d_exports$50 as is_, isin, mod_d_exports$51 as it, mod_d_exports$52 as jp, mod_d_exports$53 as kr, mod_d_exports$54 as kw, mod_d_exports$55 as kz, lei, mod_d_exports$56 as li, mod_d_exports$57 as lk, mod_d_exports$58 as lt, mod_d_exports$59 as lu, luhn, mod_d_exports$60 as lv, mod_d_exports$61 as ma, mod_d_exports$62 as mc, mod_d_exports$63 as md, mod_d_exports$64 as me, mod_d_exports$65 as mk, mod_d_exports$66 as mt, mod_d_exports$67 as mu, mod_d_exports$68 as mx, mod_d_exports$69 as my, mod_d_exports$70 as ng, mod_d_exports$71 as ni, mod_d_exports$72 as nl, mod_d_exports$73 as no, mod_d_exports$74 as nz, mod_d_exports$75 as pa, mod_d_exports$76 as pe, mod_d_exports$77 as ph, mod_d_exports$78 as pk, mod_d_exports$79 as pl, mod_d_exports$80 as pt, mod_d_exports$81 as ro, mod_d_exports$82 as rs, mod_d_exports$83 as ru, mod_d_exports$84 as se, mod_d_exports$85 as sg, mod_d_exports$86 as si, mod_d_exports$87 as sk, mod_d_exports$88 as th, mod_d_exports$89 as tr, mod_d_exports$90 as tw, mod_d_exports$91 as ua, mod_d_exports$92 as us, mod_d_exports$93 as uy, mod_d_exports$94 as ve, mod_d_exports$95 as vn, mod_d_exports$96 as za };
|
|
105
|
+
export { type CardNetwork, type CountryCode, type CountryValidator, type ErrorCode, type GlobalValidator, type ParsableValidator, type ParsedBirthDate, type ParsedIdentifier, type ParsedPersonId, type StdnumError, type ValidateResult, type Validator, type ValidatorScope, mod_d_exports as ad, mod_d_exports$1 as ae, mod_d_exports$2 as ai, mod_d_exports$3 as al, mod_d_exports$4 as am, mod_d_exports$5 as ar, mod_d_exports$6 as at, mod_d_exports$7 as au, mod_d_exports$8 as az, mod_d_exports$9 as ba, mod_d_exports$10 as bd, mod_d_exports$11 as be, mod_d_exports$12 as bg, mod_d_exports$13 as bh, bic, mod_d_exports$14 as br, mod_d_exports$15 as by, mod_d_exports$16 as bz, mod_d_exports$17 as ca, mod_d_exports$18 as ch, mod_d_exports$19 as cl, mod_d_exports$20 as cn, mod_d_exports$21 as co, mod_d_exports$22 as cr, creditCard as creditcard, mod_d_exports$23 as cu, mod_d_exports$24 as cy, mod_d_exports$25 as cz, mod_d_exports$26 as de, detectNetwork, mod_d_exports$27 as dk, mod_d_exports$28 as do_, mod_d_exports$29 as ec, mod_d_exports$30 as ee, mod_d_exports$31 as eg, mod_d_exports$32 as es, mod_d_exports$33 as eu, mod_d_exports$34 as fi, mod_d_exports$35 as fr, mod_d_exports$36 as gb, mod_d_exports$37 as ge, mod_d_exports$38 as gh, mod_d_exports$39 as gr, mod_d_exports$40 as gt, mod_d_exports$41 as hk, mod_d_exports$42 as hr, mod_d_exports$43 as hu, iban, mod_d_exports$44 as id, mod_d_exports$45 as ie, mod_d_exports$46 as il, mod_d_exports$47 as in_, mod_d_exports$48 as iq, mod_d_exports$49 as ir, mod_d_exports$50 as is_, isin, mod_d_exports$51 as it, mod_d_exports$52 as jp, mod_d_exports$53 as kr, mod_d_exports$54 as kw, mod_d_exports$55 as kz, lei, mod_d_exports$56 as li, mod_d_exports$57 as lk, mod_d_exports$58 as lt, mod_d_exports$59 as lu, luhn, mod_d_exports$60 as lv, mod_d_exports$61 as ma, mod_d_exports$62 as mc, mod_d_exports$63 as md, mod_d_exports$64 as me, mod_d_exports$65 as mk, mod_d_exports$66 as mt, mod_d_exports$67 as mu, mod_d_exports$68 as mx, mod_d_exports$69 as my, mod_d_exports$70 as ng, mod_d_exports$71 as ni, mod_d_exports$72 as nl, mod_d_exports$73 as no, mod_d_exports$74 as nz, mod_d_exports$75 as pa, mod_d_exports$76 as pe, mod_d_exports$77 as ph, mod_d_exports$78 as pk, mod_d_exports$79 as pl, mod_d_exports$80 as pt, mod_d_exports$81 as ro, mod_d_exports$82 as rs, mod_d_exports$83 as ru, mod_d_exports$84 as se, mod_d_exports$85 as sg, mod_d_exports$86 as si, mod_d_exports$87 as sk, mod_d_exports$88 as th, mod_d_exports$89 as tr, mod_d_exports$90 as tw, mod_d_exports$91 as ua, mod_d_exports$92 as us, mod_d_exports$93 as uy, mod_d_exports$94 as ve, mod_d_exports$95 as vn, mod_d_exports$96 as za };
|
package/dist/index.js
CHANGED
|
@@ -1,9 +1,3 @@
|
|
|
1
|
-
import bic from "./bic.js";
|
|
2
|
-
import creditCard, { detectNetwork } from "./creditcard.js";
|
|
3
|
-
import iban from "./iban.js";
|
|
4
|
-
import isin from "./isin.js";
|
|
5
|
-
import lei from "./lei.js";
|
|
6
|
-
import luhn from "./luhn.js";
|
|
7
1
|
import { ad_exports } from "./ad/mod.js";
|
|
8
2
|
import { ae_exports } from "./ae/mod.js";
|
|
9
3
|
import { ai_exports } from "./ai/mod.js";
|
|
@@ -18,6 +12,7 @@ import { bd_exports } from "./bd/mod.js";
|
|
|
18
12
|
import { be_exports } from "./be/mod.js";
|
|
19
13
|
import { bg_exports } from "./bg/mod.js";
|
|
20
14
|
import { bh_exports } from "./bh/mod.js";
|
|
15
|
+
import bic from "./bic.js";
|
|
21
16
|
import { br_exports } from "./br/mod.js";
|
|
22
17
|
import { by_exports } from "./by/mod.js";
|
|
23
18
|
import { bz_exports } from "./bz/mod.js";
|
|
@@ -27,6 +22,7 @@ import { cl_exports } from "./cl/mod.js";
|
|
|
27
22
|
import { cn_exports } from "./cn/mod.js";
|
|
28
23
|
import { co_exports } from "./co/mod.js";
|
|
29
24
|
import { cr_exports } from "./cr/mod.js";
|
|
25
|
+
import creditCard, { detectNetwork } from "./creditcard.js";
|
|
30
26
|
import { cu_exports } from "./cu/mod.js";
|
|
31
27
|
import { cy_exports } from "./cy/mod.js";
|
|
32
28
|
import { cz_exports } from "./cz/mod.js";
|
|
@@ -48,10 +44,14 @@ import { gt_exports } from "./gt/mod.js";
|
|
|
48
44
|
import { hk_exports } from "./hk/mod.js";
|
|
49
45
|
import { hr_exports } from "./hr/mod.js";
|
|
50
46
|
import { hu_exports } from "./hu/mod.js";
|
|
47
|
+
import iban from "./iban.js";
|
|
51
48
|
import { id_exports } from "./id/mod.js";
|
|
52
49
|
import { ie_exports } from "./ie/mod.js";
|
|
53
50
|
import { il_exports } from "./il/mod.js";
|
|
54
51
|
import { in_exports } from "./in/mod.js";
|
|
52
|
+
import isin from "./isin.js";
|
|
53
|
+
import lei from "./lei.js";
|
|
54
|
+
import luhn from "./luhn.js";
|
|
55
55
|
import { iq_exports } from "./iq/mod.js";
|
|
56
56
|
import { ir_exports } from "./ir/mod.js";
|
|
57
57
|
import { is_exports } from "./is/mod.js";
|
package/dist/iq/nid.d.ts
CHANGED
|
@@ -1,14 +1,28 @@
|
|
|
1
|
-
import {
|
|
1
|
+
import { CountryValidator, ValidateResult } from "../types.js";
|
|
2
2
|
|
|
3
3
|
//#region src/iq/nid.d.ts
|
|
4
4
|
/** Generate a random valid Iraqi NID. */
|
|
5
5
|
declare const generate: () => string;
|
|
6
|
+
/**
|
|
7
|
+
* NID (Iraqi National ID, البطاقة الوطنية الموحدة).
|
|
8
|
+
*
|
|
9
|
+
* 12-digit personal identification number on the
|
|
10
|
+
* Iraqi National Card (Unified National Card), issued
|
|
11
|
+
* by the Ministry of Interior since 2016.
|
|
12
|
+
*
|
|
13
|
+
* No public checksum algorithm is documented.
|
|
14
|
+
* Validation is limited to format: exactly 12 decimal
|
|
15
|
+
* digits. Accepts both Arabic-Indic (U+066x) and
|
|
16
|
+
* Extended Arabic-Indic (U+06Fx) digits.
|
|
17
|
+
*
|
|
18
|
+
* @see https://mofa.gov.iq/the-civil-status-id/
|
|
19
|
+
*/
|
|
6
20
|
declare const compact: (value: string) => string;
|
|
7
21
|
declare const validate: (value: string) => ValidateResult;
|
|
8
22
|
/** Iraqi NIDs are displayed without separators. */
|
|
9
23
|
declare const format: (value: string) => string;
|
|
10
24
|
/** Iraqi National Identification Number. */
|
|
11
|
-
declare const nid:
|
|
25
|
+
declare const nid: CountryValidator<"IQ">;
|
|
12
26
|
//#endregion
|
|
13
27
|
export { compact, nid as default, format, generate, validate };
|
|
14
28
|
//# sourceMappingURL=nid.d.ts.map
|
package/dist/iq/nid.js
CHANGED
|
@@ -1,23 +1,9 @@
|
|
|
1
|
+
import { normalizeArabicDigits } from "../_util/arabic.js";
|
|
1
2
|
import { clean } from "../_util/clean.js";
|
|
2
3
|
import { randomDigits } from "../_util/generate.js";
|
|
3
4
|
import { err } from "../_util/result.js";
|
|
4
5
|
import { isdigits } from "../_util/strings.js";
|
|
5
|
-
import { normalizeArabicDigits } from "../_util/arabic.js";
|
|
6
6
|
//#region src/iq/nid.ts
|
|
7
|
-
/**
|
|
8
|
-
* NID (Iraqi National ID, البطاقة الوطنية الموحدة).
|
|
9
|
-
*
|
|
10
|
-
* 12-digit personal identification number on the
|
|
11
|
-
* Iraqi National Card (Unified National Card), issued
|
|
12
|
-
* by the Ministry of Interior since 2016.
|
|
13
|
-
*
|
|
14
|
-
* No public checksum algorithm is documented.
|
|
15
|
-
* Validation is limited to format: exactly 12 decimal
|
|
16
|
-
* digits. Accepts both Arabic-Indic (U+066x) and
|
|
17
|
-
* Extended Arabic-Indic (U+06Fx) digits.
|
|
18
|
-
*
|
|
19
|
-
* @see https://mofa.gov.iq/the-civil-status-id/
|
|
20
|
-
*/
|
|
21
7
|
/** Generate a random valid Iraqi NID. */
|
|
22
8
|
const generate = () => randomDigits(12);
|
|
23
9
|
const compact = (value) => normalizeArabicDigits(clean(value, " -./"));
|
|
@@ -39,6 +25,7 @@ const nid = {
|
|
|
39
25
|
abbreviation: "NID",
|
|
40
26
|
aliases: ["NID", "البطاقة الوطنية الموحدة"],
|
|
41
27
|
candidatePattern: "\\d{12}",
|
|
28
|
+
scope: "country",
|
|
42
29
|
country: "IQ",
|
|
43
30
|
entityType: "person",
|
|
44
31
|
sourceUrl: "https://mofa.gov.iq/the-civil-status-id/",
|
package/dist/iq/nid.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"nid.js","names":[],"sources":["../../src/iq/nid.ts"],"sourcesContent":["/** Generate a random valid Iraqi NID. */\nconst generate = (): string => randomDigits(12);\n\n/**\n * NID (Iraqi National ID, البطاقة الوطنية الموحدة).\n *\n * 12-digit personal identification number on the\n * Iraqi National Card (Unified National Card), issued\n * by the Ministry of Interior since 2016.\n *\n * No public checksum algorithm is documented.\n * Validation is limited to format: exactly 12 decimal\n * digits. Accepts both Arabic-Indic (U+066x) and\n * Extended Arabic-Indic (U+06Fx) digits.\n *\n * @see https://mofa.gov.iq/the-civil-status-id/\n */\n\nimport { normalizeArabicDigits } from \"#util/arabic\";\nimport { clean } from \"#util/clean\";\nimport { randomDigits } from \"#util/generate\";\nimport { err } from \"#util/result\";\nimport { isdigits } from \"#util/strings\";\n\
|
|
1
|
+
{"version":3,"file":"nid.js","names":[],"sources":["../../src/iq/nid.ts"],"sourcesContent":["/** Generate a random valid Iraqi NID. */\nconst generate = (): string => randomDigits(12);\n\n/**\n * NID (Iraqi National ID, البطاقة الوطنية الموحدة).\n *\n * 12-digit personal identification number on the\n * Iraqi National Card (Unified National Card), issued\n * by the Ministry of Interior since 2016.\n *\n * No public checksum algorithm is documented.\n * Validation is limited to format: exactly 12 decimal\n * digits. Accepts both Arabic-Indic (U+066x) and\n * Extended Arabic-Indic (U+06Fx) digits.\n *\n * @see https://mofa.gov.iq/the-civil-status-id/\n */\n\nimport type {\n ValidateResult,\n CountryValidator,\n} from \"../types\";\n\nimport { normalizeArabicDigits } from \"#util/arabic\";\nimport { clean } from \"#util/clean\";\nimport { randomDigits } from \"#util/generate\";\nimport { err } from \"#util/result\";\nimport { isdigits } from \"#util/strings\";\n\nconst compact = (value: string): string =>\n normalizeArabicDigits(clean(value, \" -./\"));\n\nconst validate = (value: string): ValidateResult => {\n const v = compact(value);\n if (v.length !== 12) {\n return err(\n \"INVALID_LENGTH\",\n \"Iraqi NID must be exactly 12 digits\",\n );\n }\n if (!isdigits(v)) {\n return err(\n \"INVALID_FORMAT\",\n \"Iraqi NID must contain only digits\",\n );\n }\n return { valid: true, compact: v };\n};\n\n/** Iraqi NIDs are displayed without separators. */\nconst format = (value: string): string => compact(value);\n\n/** Iraqi National Identification Number. */\nconst nid: CountryValidator<\"IQ\"> = {\n name: \"Iraqi National ID\",\n localName: \"البطاقة الوطنية الموحدة\",\n abbreviation: \"NID\",\n aliases: [\"NID\", \"البطاقة الوطنية الموحدة\"] as const,\n candidatePattern: \"\\\\d{12}\",\n scope: \"country\",\n country: \"IQ\",\n entityType: \"person\",\n sourceUrl: \"https://mofa.gov.iq/the-civil-status-id/\",\n description:\n \"Iraqi personal identification number (National Card)\",\n lengths: [12] as const,\n examples: [\"012345678901\"] as const,\n compact,\n format,\n validate,\n generate,\n};\n\nexport default nid;\nexport { compact, format, validate, generate };\n"],"mappings":";;;;;;;AACA,MAAM,iBAAyB,aAAa,EAAE;AA4B9C,MAAM,WAAW,UACf,sBAAsB,MAAM,OAAO,MAAM,CAAC;AAE5C,MAAM,YAAY,UAAkC;CAClD,MAAM,IAAI,QAAQ,KAAK;CACvB,IAAI,EAAE,WAAW,IACf,OAAO,IACL,kBACA,qCACF;CAEF,IAAI,CAAC,SAAS,CAAC,GACb,OAAO,IACL,kBACA,oCACF;CAEF,OAAO;EAAE,OAAO;EAAM,SAAS;CAAE;AACnC;;AAGA,MAAM,UAAU,UAA0B,QAAQ,KAAK;;AAGvD,MAAM,MAA8B;CAClC,MAAM;CACN,WAAW;CACX,cAAc;CACd,SAAS,CAAC,OAAO,yBAAyB;CAC1C,kBAAkB;CAClB,OAAO;CACP,SAAS;CACT,YAAY;CACZ,WAAW;CACX,aACE;CACF,SAAS,CAAC,EAAE;CACZ,UAAU,CAAC,cAAc;CACzB;CACA;CACA;CACA;AACF"}
|
package/dist/ir/nid.d.ts
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import {
|
|
1
|
+
import { CountryValidator, ValidateResult } from "../types.js";
|
|
2
2
|
|
|
3
3
|
//#region src/ir/nid.d.ts
|
|
4
4
|
declare const compact: (value: string) => string;
|
|
@@ -11,7 +11,7 @@ declare const format: (value: string) => string;
|
|
|
11
11
|
*/
|
|
12
12
|
declare const generate: () => string;
|
|
13
13
|
/** Iranian National Identification Number. */
|
|
14
|
-
declare const nid:
|
|
14
|
+
declare const nid: CountryValidator<"IR">;
|
|
15
15
|
//#endregion
|
|
16
16
|
export { compact, nid as default, format, generate, validate };
|
|
17
17
|
//# sourceMappingURL=nid.d.ts.map
|
package/dist/ir/nid.js
CHANGED
|
@@ -1,32 +1,9 @@
|
|
|
1
|
+
import { normalizeArabicDigits } from "../_util/arabic.js";
|
|
1
2
|
import { clean } from "../_util/clean.js";
|
|
2
3
|
import { randomDigits } from "../_util/generate.js";
|
|
3
4
|
import { err } from "../_util/result.js";
|
|
4
5
|
import { isdigits } from "../_util/strings.js";
|
|
5
|
-
import { normalizeArabicDigits } from "../_util/arabic.js";
|
|
6
6
|
//#region src/ir/nid.ts
|
|
7
|
-
/**
|
|
8
|
-
* NID (Iranian National ID, کد ملی, Code Melli).
|
|
9
|
-
*
|
|
10
|
-
* 10-digit personal identification number assigned to
|
|
11
|
-
* every Iranian citizen. Digits 1-3 encode the province,
|
|
12
|
-
* digits 4-9 are a sequential identifier, and digit 10
|
|
13
|
-
* is a check digit.
|
|
14
|
-
*
|
|
15
|
-
* Check digit algorithm (mod 11):
|
|
16
|
-
* sum = Σ(digit[i] × (10 − i)) for i = 0..8
|
|
17
|
-
* r = sum mod 11
|
|
18
|
-
* if r < 2: check digit = r
|
|
19
|
-
* if r ≥ 2: check digit = 11 − r
|
|
20
|
-
*
|
|
21
|
-
* Numbers where all digits are identical (e.g.
|
|
22
|
-
* 0000000000, 1111111111) are rejected.
|
|
23
|
-
*
|
|
24
|
-
* Accepts both Persian (Extended Arabic-Indic, U+06Fx)
|
|
25
|
-
* and Arabic-Indic (U+066x) digits.
|
|
26
|
-
*
|
|
27
|
-
* @see https://www.sabteahval.ir/
|
|
28
|
-
* @see https://persian-tools.js.org/functions/verifyIranianNationalId.html
|
|
29
|
-
*/
|
|
30
7
|
/** All-same-digit patterns (0000000000 .. 9999999999). */
|
|
31
8
|
const ALL_SAME = new Set(Array.from({ length: 10 }, (_, i) => String(i).repeat(10)));
|
|
32
9
|
const compact = (value) => normalizeArabicDigits(clean(value, " -./"));
|
|
@@ -73,6 +50,7 @@ const nid = {
|
|
|
73
50
|
"national code"
|
|
74
51
|
],
|
|
75
52
|
candidatePattern: "\\d{10}",
|
|
53
|
+
scope: "country",
|
|
76
54
|
country: "IR",
|
|
77
55
|
entityType: "person",
|
|
78
56
|
sourceUrl: "https://www.sabteahval.ir/",
|
package/dist/ir/nid.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"nid.js","names":[],"sources":["../../src/ir/nid.ts"],"sourcesContent":["/**\n * NID (Iranian National ID, کد ملی, Code Melli).\n *\n * 10-digit personal identification number assigned to\n * every Iranian citizen. Digits 1-3 encode the province,\n * digits 4-9 are a sequential identifier, and digit 10\n * is a check digit.\n *\n * Check digit algorithm (mod 11):\n * sum = Σ(digit[i] × (10 − i)) for i = 0..8\n * r = sum mod 11\n * if r < 2: check digit = r\n * if r ≥ 2: check digit = 11 − r\n *\n * Numbers where all digits are identical (e.g.\n * 0000000000, 1111111111) are rejected.\n *\n * Accepts both Persian (Extended Arabic-Indic, U+06Fx)\n * and Arabic-Indic (U+066x) digits.\n *\n * @see https://www.sabteahval.ir/\n * @see https://persian-tools.js.org/functions/verifyIranianNationalId.html\n */\n\nimport { normalizeArabicDigits } from \"#util/arabic\";\nimport { clean } from \"#util/clean\";\nimport { randomDigits } from \"#util/generate\";\nimport { err } from \"#util/result\";\nimport { isdigits } from \"#util/strings\";\n\
|
|
1
|
+
{"version":3,"file":"nid.js","names":[],"sources":["../../src/ir/nid.ts"],"sourcesContent":["/**\n * NID (Iranian National ID, کد ملی, Code Melli).\n *\n * 10-digit personal identification number assigned to\n * every Iranian citizen. Digits 1-3 encode the province,\n * digits 4-9 are a sequential identifier, and digit 10\n * is a check digit.\n *\n * Check digit algorithm (mod 11):\n * sum = Σ(digit[i] × (10 − i)) for i = 0..8\n * r = sum mod 11\n * if r < 2: check digit = r\n * if r ≥ 2: check digit = 11 − r\n *\n * Numbers where all digits are identical (e.g.\n * 0000000000, 1111111111) are rejected.\n *\n * Accepts both Persian (Extended Arabic-Indic, U+06Fx)\n * and Arabic-Indic (U+066x) digits.\n *\n * @see https://www.sabteahval.ir/\n * @see https://persian-tools.js.org/functions/verifyIranianNationalId.html\n */\n\nimport type {\n ValidateResult,\n CountryValidator,\n} from \"../types\";\n\nimport { normalizeArabicDigits } from \"#util/arabic\";\nimport { clean } from \"#util/clean\";\nimport { randomDigits } from \"#util/generate\";\nimport { err } from \"#util/result\";\nimport { isdigits } from \"#util/strings\";\n\n/** All-same-digit patterns (0000000000 .. 9999999999). */\nconst ALL_SAME = new Set(\n Array.from({ length: 10 }, (_, i) =>\n String(i).repeat(10),\n ),\n);\n\nconst compact = (value: string): string =>\n normalizeArabicDigits(clean(value, \" -./\"));\n\n/**\n * Calculate the check digit from the first 9 digits.\n */\nconst calcCheckDigit = (number: string): number => {\n let sum = 0;\n for (let i = 0; i < 9; i++) {\n sum += Number(number[i]) * (10 - i);\n }\n const r = sum % 11;\n return r < 2 ? r : 11 - r;\n};\n\nconst validate = (value: string): ValidateResult => {\n const v = compact(value);\n if (v.length !== 10) {\n return err(\n \"INVALID_LENGTH\",\n \"Iranian NID must be exactly 10 digits\",\n );\n }\n if (!isdigits(v)) {\n return err(\n \"INVALID_FORMAT\",\n \"Iranian NID must contain only digits\",\n );\n }\n if (ALL_SAME.has(v)) {\n return err(\n \"INVALID_FORMAT\",\n \"Iranian NID must not have all identical digits\",\n );\n }\n if (calcCheckDigit(v) !== Number(v[9])) {\n return err(\n \"INVALID_CHECKSUM\",\n \"Iranian NID check digit mismatch\",\n );\n }\n return { valid: true, compact: v };\n};\n\n/** Iranian NIDs are displayed without separators. */\nconst format = (value: string): string => compact(value);\n\n/**\n * Generate a random valid Iranian NID.\n * NOT cryptographically secure.\n */\nconst generate = (): string => {\n const base = randomDigits(9);\n const check = calcCheckDigit(base);\n const result = `${base}${check}`;\n if (ALL_SAME.has(result)) return generate();\n return result;\n};\n\n/** Iranian National Identification Number. */\nconst nid: CountryValidator<\"IR\"> = {\n name: \"Iranian National ID\",\n localName: \"کد ملی\",\n abbreviation: \"NID\",\n aliases: [\"NID\", \"کد ملی\", \"national code\"] as const,\n candidatePattern: \"\\\\d{10}\",\n scope: \"country\",\n country: \"IR\",\n entityType: \"person\",\n sourceUrl: \"https://www.sabteahval.ir/\",\n description:\n \"Iranian personal identification number (Code Melli)\",\n lengths: [10] as const,\n examples: [\"0932833810\"] as const,\n compact,\n format,\n validate,\n generate,\n};\n\nexport default nid;\nexport { compact, format, validate, generate };\n"],"mappings":";;;;;;;AAoCA,MAAM,WAAW,IAAI,IACnB,MAAM,KAAK,EAAE,QAAQ,GAAG,IAAI,GAAG,MAC7B,OAAO,CAAC,EAAE,OAAO,EAAE,CACrB,CACF;AAEA,MAAM,WAAW,UACf,sBAAsB,MAAM,OAAO,MAAM,CAAC;;;;AAK5C,MAAM,kBAAkB,WAA2B;CACjD,IAAI,MAAM;CACV,KAAK,IAAI,IAAI,GAAG,IAAI,GAAG,KACrB,OAAO,OAAO,OAAO,EAAE,KAAK,KAAK;CAEnC,MAAM,IAAI,MAAM;CAChB,OAAO,IAAI,IAAI,IAAI,KAAK;AAC1B;AAEA,MAAM,YAAY,UAAkC;CAClD,MAAM,IAAI,QAAQ,KAAK;CACvB,IAAI,EAAE,WAAW,IACf,OAAO,IACL,kBACA,uCACF;CAEF,IAAI,CAAC,SAAS,CAAC,GACb,OAAO,IACL,kBACA,sCACF;CAEF,IAAI,SAAS,IAAI,CAAC,GAChB,OAAO,IACL,kBACA,gDACF;CAEF,IAAI,eAAe,CAAC,MAAM,OAAO,EAAE,EAAE,GACnC,OAAO,IACL,oBACA,kCACF;CAEF,OAAO;EAAE,OAAO;EAAM,SAAS;CAAE;AACnC;;AAGA,MAAM,UAAU,UAA0B,QAAQ,KAAK;;;;;AAMvD,MAAM,iBAAyB;CAC7B,MAAM,OAAO,aAAa,CAAC;CAE3B,MAAM,SAAS,GAAG,OADJ,eAAe,IACA;CAC7B,IAAI,SAAS,IAAI,MAAM,GAAG,OAAO,SAAS;CAC1C,OAAO;AACT;;AAGA,MAAM,MAA8B;CAClC,MAAM;CACN,WAAW;CACX,cAAc;CACd,SAAS;EAAC;EAAO;EAAU;CAAe;CAC1C,kBAAkB;CAClB,OAAO;CACP,SAAS;CACT,YAAY;CACZ,WAAW;CACX,aACE;CACF,SAAS,CAAC,EAAE;CACZ,UAAU,CAAC,YAAY;CACvB;CACA;CACA;CACA;AACF"}
|
package/dist/is/kennitala.d.ts
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import {
|
|
1
|
+
import { CountryValidator, ValidateResult } from "../types.js";
|
|
2
2
|
|
|
3
3
|
//#region src/is/kennitala.d.ts
|
|
4
4
|
declare const compact: (value: string) => string;
|
|
@@ -7,7 +7,7 @@ declare const format: (value: string) => string;
|
|
|
7
7
|
/** Generate a random valid Icelandic kennitala. */
|
|
8
8
|
declare const generate: () => string;
|
|
9
9
|
/** Icelandic Identification Number. */
|
|
10
|
-
declare const kennitala:
|
|
10
|
+
declare const kennitala: CountryValidator<"IS">;
|
|
11
11
|
//#endregion
|
|
12
12
|
export { compact, kennitala as default, format, generate, validate };
|
|
13
13
|
//# sourceMappingURL=kennitala.d.ts.map
|
package/dist/is/kennitala.js
CHANGED
|
@@ -1,21 +1,9 @@
|
|
|
1
1
|
import { clean } from "../_util/clean.js";
|
|
2
|
+
import { isValidDate } from "../_util/date.js";
|
|
2
3
|
import { randomInt } from "../_util/generate.js";
|
|
3
4
|
import { err } from "../_util/result.js";
|
|
4
5
|
import { isdigits } from "../_util/strings.js";
|
|
5
|
-
import { isValidDate } from "../_util/date.js";
|
|
6
6
|
//#region src/is/kennitala.ts
|
|
7
|
-
/**
|
|
8
|
-
* Kennitala (Icelandic identification number).
|
|
9
|
-
*
|
|
10
|
-
* 10 digits: DDMMYY + 2 random + 1 check + 1 century.
|
|
11
|
-
* Weights [3,2,7,6,5,4,3,2] on first 8 digits,
|
|
12
|
-
* check digit at position 9, century at position 10
|
|
13
|
-
* (weight 0, does not participate in checksum).
|
|
14
|
-
* Organizations use day + 40. Century digit: 9 = 1900s,
|
|
15
|
-
* 0 = 2000s.
|
|
16
|
-
*
|
|
17
|
-
* @see https://www.skra.is/
|
|
18
|
-
*/
|
|
19
7
|
const WEIGHTS = [
|
|
20
8
|
3,
|
|
21
9
|
2,
|
|
@@ -77,6 +65,7 @@ const kennitala = {
|
|
|
77
65
|
abbreviation: "kt.",
|
|
78
66
|
aliases: ["kennitala", "kt."],
|
|
79
67
|
candidatePattern: "\\d{6}-?\\d{4}",
|
|
68
|
+
scope: "country",
|
|
80
69
|
country: "IS",
|
|
81
70
|
entityType: "any",
|
|
82
71
|
sourceUrl: "https://www.skra.is/",
|
package/dist/is/kennitala.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"kennitala.js","names":[],"sources":["../../src/is/kennitala.ts"],"sourcesContent":["/**\n * Kennitala (Icelandic identification number).\n *\n * 10 digits: DDMMYY + 2 random + 1 check + 1 century.\n * Weights [3,2,7,6,5,4,3,2] on first 8 digits,\n * check digit at position 9, century at position 10\n * (weight 0, does not participate in checksum).\n * Organizations use day + 40. Century digit: 9 = 1900s,\n * 0 = 2000s.\n *\n * @see https://www.skra.is/\n */\n\nimport { clean } from \"#util/clean\";\nimport { isValidDate } from \"#util/date\";\nimport { randomInt } from \"#util/generate\";\nimport { err } from \"#util/result\";\nimport { isdigits } from \"#util/strings\";\n\
|
|
1
|
+
{"version":3,"file":"kennitala.js","names":[],"sources":["../../src/is/kennitala.ts"],"sourcesContent":["/**\n * Kennitala (Icelandic identification number).\n *\n * 10 digits: DDMMYY + 2 random + 1 check + 1 century.\n * Weights [3,2,7,6,5,4,3,2] on first 8 digits,\n * check digit at position 9, century at position 10\n * (weight 0, does not participate in checksum).\n * Organizations use day + 40. Century digit: 9 = 1900s,\n * 0 = 2000s.\n *\n * @see https://www.skra.is/\n */\n\nimport type {\n ValidateResult,\n CountryValidator,\n} from \"../types\";\n\nimport { clean } from \"#util/clean\";\nimport { isValidDate } from \"#util/date\";\nimport { randomInt } from \"#util/generate\";\nimport { err } from \"#util/result\";\nimport { isdigits } from \"#util/strings\";\n\nconst WEIGHTS = [3, 2, 7, 6, 5, 4, 3, 2, 0, 0] as const;\n\nconst compact = (value: string): string =>\n clean(value, \" -\");\n\nconst validate = (value: string): ValidateResult => {\n const v = compact(value);\n if (v.length !== 10) {\n return err(\n \"INVALID_LENGTH\",\n \"Kennitala must be 10 digits\",\n );\n }\n if (!isdigits(v)) {\n return err(\n \"INVALID_FORMAT\",\n \"Kennitala must contain only digits\",\n );\n }\n\n // Checksum: weights on first 8 digits, check is 9th\n let sum = 0;\n for (let i = 0; i < 8; i++) {\n sum += Number(v.charAt(i)) * (WEIGHTS[i] ?? 0);\n }\n const remainder = (11 - (sum % 11)) % 11;\n if (remainder === 10 || remainder !== Number(v[8])) {\n return err(\n \"INVALID_CHECKSUM\",\n \"Kennitala check digit mismatch\",\n );\n }\n\n // Parse date\n let dd = Number(v.slice(0, 2));\n const mm = Number(v.slice(2, 4));\n const yy = Number(v.slice(4, 6));\n const centuryDigit = Number(v[9]);\n\n // Organizations use day + 40\n if (dd > 40) dd -= 40;\n\n let century: number;\n if (centuryDigit === 9) {\n century = 1900;\n } else if (centuryDigit === 0) {\n century = 2000;\n } else {\n return err(\n \"INVALID_COMPONENT\",\n \"Kennitala century digit must be 0 or 9\",\n );\n }\n\n const year = century + yy;\n if (!isValidDate(year, mm, dd)) {\n return err(\n \"INVALID_COMPONENT\",\n \"Kennitala contains an invalid date\",\n );\n }\n\n return { valid: true, compact: v };\n};\n\nconst format = (value: string): string => {\n const v = compact(value);\n return `${v.slice(0, 6)}-${v.slice(6)}`;\n};\n\n/** Generate a random valid Icelandic kennitala. */\nconst generate = (): string => {\n for (;;) {\n const dd = String(randomInt(1, 28)).padStart(2, \"0\");\n const mm = String(randomInt(1, 12)).padStart(2, \"0\");\n const yy = String(randomInt(50, 99)).padStart(2, \"0\");\n const rr = String(randomInt(20, 99)).padStart(2, \"0\");\n const partial = dd + mm + yy + rr;\n for (let d = 0; d <= 9; d++) {\n const c = partial + String(d) + \"9\";\n if (validate(c).valid) return c;\n }\n }\n};\n\n/** Icelandic Identification Number. */\nconst kennitala: CountryValidator<\"IS\"> = {\n name: \"Icelandic ID Number\",\n localName: \"Kennitala\",\n abbreviation: \"kt.\",\n aliases: [\"kennitala\", \"kt.\"] as const,\n candidatePattern: \"\\\\d{6}-?\\\\d{4}\",\n scope: \"country\",\n country: \"IS\",\n entityType: \"any\",\n sourceUrl: \"https://www.skra.is/\",\n examples: [\"4504013150\", \"1201743399\"] as const,\n compact,\n format,\n validate,\n generate,\n};\n\nexport default kennitala;\nexport { compact, format, validate, generate };\n"],"mappings":";;;;;;AAwBA,MAAM,UAAU;CAAC;CAAG;CAAG;CAAG;CAAG;CAAG;CAAG;CAAG;CAAG;CAAG;AAAC;AAE7C,MAAM,WAAW,UACf,MAAM,OAAO,IAAI;AAEnB,MAAM,YAAY,UAAkC;CAClD,MAAM,IAAI,QAAQ,KAAK;CACvB,IAAI,EAAE,WAAW,IACf,OAAO,IACL,kBACA,6BACF;CAEF,IAAI,CAAC,SAAS,CAAC,GACb,OAAO,IACL,kBACA,oCACF;CAIF,IAAI,MAAM;CACV,KAAK,IAAI,IAAI,GAAG,IAAI,GAAG,KACrB,OAAO,OAAO,EAAE,OAAO,CAAC,CAAC,KAAK,QAAQ,MAAM;CAE9C,MAAM,aAAa,KAAM,MAAM,MAAO;CACtC,IAAI,cAAc,MAAM,cAAc,OAAO,EAAE,EAAE,GAC/C,OAAO,IACL,oBACA,gCACF;CAIF,IAAI,KAAK,OAAO,EAAE,MAAM,GAAG,CAAC,CAAC;CAC7B,MAAM,KAAK,OAAO,EAAE,MAAM,GAAG,CAAC,CAAC;CAC/B,MAAM,KAAK,OAAO,EAAE,MAAM,GAAG,CAAC,CAAC;CAC/B,MAAM,eAAe,OAAO,EAAE,EAAE;CAGhC,IAAI,KAAK,IAAI,MAAM;CAEnB,IAAI;CACJ,IAAI,iBAAiB,GACnB,UAAU;MACL,IAAI,iBAAiB,GAC1B,UAAU;MAEV,OAAO,IACL,qBACA,wCACF;CAIF,IAAI,CAAC,YADQ,UAAU,IACA,IAAI,EAAE,GAC3B,OAAO,IACL,qBACA,oCACF;CAGF,OAAO;EAAE,OAAO;EAAM,SAAS;CAAE;AACnC;AAEA,MAAM,UAAU,UAA0B;CACxC,MAAM,IAAI,QAAQ,KAAK;CACvB,OAAO,GAAG,EAAE,MAAM,GAAG,CAAC,EAAE,GAAG,EAAE,MAAM,CAAC;AACtC;;AAGA,MAAM,iBAAyB;CAC7B,SAAS;EACP,MAAM,KAAK,OAAO,UAAU,GAAG,EAAE,CAAC,EAAE,SAAS,GAAG,GAAG;EACnD,MAAM,KAAK,OAAO,UAAU,GAAG,EAAE,CAAC,EAAE,SAAS,GAAG,GAAG;EACnD,MAAM,KAAK,OAAO,UAAU,IAAI,EAAE,CAAC,EAAE,SAAS,GAAG,GAAG;EACpD,MAAM,KAAK,OAAO,UAAU,IAAI,EAAE,CAAC,EAAE,SAAS,GAAG,GAAG;EACpD,MAAM,UAAU,KAAK,KAAK,KAAK;EAC/B,KAAK,IAAI,IAAI,GAAG,KAAK,GAAG,KAAK;GAC3B,MAAM,IAAI,UAAU,OAAO,CAAC,IAAI;GAChC,IAAI,SAAS,CAAC,EAAE,OAAO,OAAO;EAChC;CACF;AACF;;AAGA,MAAM,YAAoC;CACxC,MAAM;CACN,WAAW;CACX,cAAc;CACd,SAAS,CAAC,aAAa,KAAK;CAC5B,kBAAkB;CAClB,OAAO;CACP,SAAS;CACT,YAAY;CACZ,WAAW;CACX,UAAU,CAAC,cAAc,YAAY;CACrC;CACA;CACA;CACA;AACF"}
|