
Security News
Attackers Are Hunting High-Impact Node.js Maintainers in a Coordinated Social Engineering Campaign
Multiple high-impact npm maintainers confirm they have been targeted in the same social engineering campaign that compromised Axios.
turkish-form-validator
Advanced tools
A comprehensive validation library for Turkish forms including TCKN, phone numbers, tax numbers, license plates, and IBAN validation.
npm install turkish-form-validator
or
yarn add turkish-form-validator
import { validateTCKN } from "turkish-form-validator";
const result = validateTCKN("12345678950");
if (result.isValid) {
console.log("Valid TCKN");
} else {
console.log(result.error);
}
import { validateTurkishPhone } from "turkish-form-validator";
const result = validateTurkishPhone("0532 123 45 67");
if (result.valid) {
console.log("Valid phone:", result.formatted); // +905321234567
} else {
console.log(result.message);
}
import { validateTaxNo } from "turkish-form-validator";
const result = validateTaxNo("1234567890");
if (result.valid) {
console.log("Valid tax number:", result.formatted);
} else {
console.log(result.message);
}
For corporate (Ltd./A.Ş.) taxpayers, tax numbers can start with 0. To support these scenarios, you can pass isCorporate: true as the second parameter:
const corporateResult = validateTaxNo("0000000005", { isCorporate: true });
import { validateTurkishPlate } from "turkish-form-validator";
const result = validateTurkishPlate("06 ABC 123");
if (result.valid) {
console.log("Valid plate:", result.formatted);
console.log("City:", result.cityName);
console.log("Type:", result.plateType);
} else {
console.log(result.message);
}
import { validateTurkishIBAN } from "turkish-form-validator";
const result = validateTurkishIBAN("TR330006100519786457841326");
if (result.valid) {
console.log("Valid IBAN:", result.formatted);
console.log("Bank:", result.bankName);
} else {
console.log(result.message);
}
import { useState } from "react";
import { validateTCKN } from "turkish-form-validator";
function TCKNInput() {
const [error, setError] = useState<string>("");
const handleChange = (e: React.ChangeEvent<HTMLInputElement>) => {
const result = validateTCKN(e.target.value);
if (!result.isValid) {
setError(result.error || "");
} else {
setError("");
}
};
return (
<div>
<input type="text" onChange={handleChange} />
{error && <span className="error">{error}</span>}
</div>
);
}
<template>
<div>
<input v-model="phone" @input="validate" />
<p v-if="error" class="error">{{ error }}</p>
</div>
</template>
<script setup lang="ts">
import { ref } from "vue";
import { validateTurkishPhone } from "turkish-form-validator";
const phone = ref("");
const error = ref("");
const validate = () => {
const result = validateTurkishPhone(phone.value);
error.value = result.valid ? "" : result.message;
};
</script>
import { Component } from "@angular/core";
import { FormControl, Validators } from "@angular/forms";
import { validateTCKN } from "turkish-form-validator";
@Component({
selector: "app-tckn-input",
template: `
<input [formControl]="tcknControl" />
<div *ngIf="tcknControl.invalid && tcknControl.dirty">
{{ tcknControl.errors?.['tckn'] }}
</div>
`,
})
export class TCKNInputComponent {
tcknControl = new FormControl("", [this.tcknValidator]);
tcknValidator(control: FormControl) {
const result = validateTCKN(control.value);
return result.isValid ? null : { tckn: result.error };
}
}
import { validateTaxNo } from "turkish-form-validator";
document.getElementById("tax-input").addEventListener("input", (e) => {
const result = validateTaxNo(e.target.value);
const errorDiv = document.getElementById("error");
if (result.valid) {
errorDiv.textContent = "";
errorDiv.style.display = "none";
} else {
errorDiv.textContent = result.message;
errorDiv.style.display = "block";
}
});
Dilara Uluturhan - LinkedIn - dilarauluturhan@outlook.com
npm install turkish-form-validator
veya
yarn add turkish-form-validator
import { validateTCKN } from "turkish-form-validator";
const result = validateTCKN("12345678950");
if (result.isValid) {
console.log("Geçerli TCKN");
} else {
console.log(result.error);
}
import { validateTurkishPhone } from "turkish-form-validator";
const result = validateTurkishPhone("0532 123 45 67");
if (result.valid) {
console.log("Geçerli telefon:", result.formatted); // +905321234567
} else {
console.log(result.message);
}
import { validateTaxNo } from "turkish-form-validator";
const result = validateTaxNo("1234567890");
if (result.valid) {
console.log("Geçerli vergi numarası:", result.formatted);
} else {
console.log(result.message);
}
Kurumsal (Ltd./A.Ş.) mükellefler için vergi numaraları 0 ile başlayabilir. Bu senaryoları desteklemek için ikinci parametre olarak isCorporate: true gönderebilirsiniz:
const corporateResult = validateTaxNo("0000000005", { isCorporate: true });
console.log(corporateResult.valid); // true
import { validateTurkishPlate } from "turkish-form-validator";
const result = validateTurkishPlate("06 ABC 123");
if (result.valid) {
console.log("Geçerli plaka:", result.formatted);
console.log("İl:", result.cityName);
console.log("Tip:", result.plateType);
} else {
console.log(result.message);
}
import { validateTurkishIBAN } from "turkish-form-validator";
const result = validateTurkishIBAN("TR330006100519786457841326");
if (result.valid) {
console.log("Geçerli IBAN:", result.formatted);
console.log("Banka:", result.bankName);
} else {
console.log(result.message);
}
import { useState } from "react";
import { validateTCKN } from "turkish-form-validator";
function TCKNInput() {
const [error, setError] = useState<string>("");
const handleChange = (e: React.ChangeEvent<HTMLInputElement>) => {
const result = validateTCKN(e.target.value);
if (!result.isValid) {
setError(result.error || "");
} else {
setError("");
}
};
return (
<div>
<input type="text" onChange={handleChange} />
{error && <span className="error">{error}</span>}
</div>
);
}
<template>
<div>
<input v-model="phone" @input="validate" />
<p v-if="error" class="error">{{ error }}</p>
</div>
</template>
<script setup lang="ts">
import { ref } from "vue";
import { validateTurkishPhone } from "turkish-form-validator";
const phone = ref("");
const error = ref("");
const validate = () => {
const result = validateTurkishPhone(phone.value);
error.value = result.valid ? "" : result.message;
};
</script>
import { Component } from "@angular/core";
import { FormControl, Validators } from "@angular/forms";
import { validateTCKN } from "turkish-form-validator";
@Component({
selector: "app-tckn-input",
template: `
<input [formControl]="tcknControl" />
<div *ngIf="tcknControl.invalid && tcknControl.dirty">
{{ tcknControl.errors?.['tckn'] }}
</div>
`,
})
export class TCKNInputComponent {
tcknControl = new FormControl("", [this.tcknValidator]);
tcknValidator(control: FormControl) {
const result = validateTCKN(control.value);
return result.isValid ? null : { tckn: result.error };
}
}
import { validateTaxNo } from "turkish-form-validator";
document.getElementById("tax-input").addEventListener("input", (e) => {
const result = validateTaxNo(e.target.value);
const errorDiv = document.getElementById("error");
if (result.valid) {
errorDiv.textContent = "";
errorDiv.style.display = "none";
} else {
errorDiv.textContent = result.message;
errorDiv.style.display = "block";
}
});
Dilara Uluturhan - LinkedIn - dilarauluturhan@outlook.com
FAQs
Turkish form validation library
The npm package turkish-form-validator receives a total of 0 weekly downloads. As such, turkish-form-validator popularity was classified as not popular.
We found that turkish-form-validator demonstrated a healthy version release cadence and project activity because the last version was released less than a year ago. It has 1 open source maintainer collaborating on the project.
Did you know?

Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.

Security News
Multiple high-impact npm maintainers confirm they have been targeted in the same social engineering campaign that compromised Axios.

Security News
Axios compromise traced to social engineering, showing how attacks on maintainers can bypass controls and expose the broader software supply chain.

Security News
Node.js has paused its bug bounty program after funding ended, removing payouts for vulnerability reports but keeping its security process unchanged.