UNPKG

tc-check

Version:

A Node.js and TypeScript package to validate Turkish citizens using first name, last name, birth year, and T.C. Kimlik Number via the official government API.

13 lines (10 loc) 498 B
import { Validator, SoapService, APIService, VerificationService, Person, } from './index'; const validator = new Validator(); const soap = new SoapService(); const api = new APIService(soap); const service = new VerificationService(validator, api); const fakeTc = validator.generateFakeTC(); const person: Person = { firstName: 'Ali', lastName: 'Veli', birthYear: 1995, tc: fakeTc }; service.verify(person) .then(result => console.log(result)) .catch(err => console.error(err));