Socket
Book a DemoInstallSign in
Socket

validate-kaike-js

Package Overview
Dependencies
Maintainers
0
Versions
1
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

validate-kaike-js

A small validation library

1.0.0
latest
Source
npmnpm
Version published
Weekly downloads
0
Maintainers
0
Weekly downloads
 
Created
Source

🚀 validate-kaike-js

A modern and lightweight library for validating emails, identity cards (ID), IBANs, passports, and phone numbers. ✅

📦 Installation

Install the library using your favorite package manager:

# Using npm
npm install validate-kaike-js

# Using yarn
yarn add validate-kaike-js

# Using pnpm
pnpm add validate-kaike-js

🚀 How to Use

The validate function must always be used for both single and multiple validations, ensuring consistency and simplicity in implementation.

🎯 Single Validation

import {
  validate,
  validateEmail,
  validateIdentityCard,
  validateIban,
  validatePassport,
  validatePhoneCountryCode,
} from "validate-kaike-js";

validate([{ fn: validateEmail, input: "test@email.com", provider: "GMAIL" }])
  .then(console.log)
  .catch(console.error);

validate([{ fn: validateIdentityCard, input: "123456789LA001", country: "AO" }])
  .then(console.log)
  .catch(console.error);

If the input is invalid, an error will be thrown:

validate([{ fn: validateEmail, input: "invalid_email", provider: "GMAIL" }]).catch(console.error);

Output:

[{ message: "Invalid email", value: "invalid_email" }];

🔄 Multiple Validation

Validate multiple inputs simultaneously with validate():

validate([
  { fn: validateEmail, input: "test@email.com", provider: "GMAIL" },
  { fn: validateIdentityCard, input: "123456789LA001", country: "AO" },
  { fn: validateIban, input: "AO06123456789012345678901", country: "AO" },
  { fn: validatePassport, input: "A1234567", country: "US" },
  { fn: validatePhoneCountryCode, input: "+244923456789", phoneCountryCode: "+244" },
])
  .then(console.log)
  .catch(console.error);

If all validations pass, the return will be an array with the results:

[
  { message: "Valid email", value: "test@email.com" },
  { message: "Valid identity card", value: "123456789LA001" },
  { message: "Valid IBAN", value: "AO06123456789012345678901" },
  { message: "Valid Passport", value: "A1234567" },
  { message: "Valid phone country code", value: "+244923456789" },
];

If any validation fails, validate rejects the promise with an array of errors:

validate([{ fn: validateEmail, input: "invalid_email", provider: "GMAIL" }]).catch(console.error);

Output:

[{ message: "Invalid email", value: "invalid_email" }];

📜 Available Methods

MethodValidatesValid ExampleInvalid ExampleAdditional Argument
validateEmailEmailtest@email.cominvalid_emailprovider (only for this method)
validateIdentityCardIdentity card123456789LA00112345ABCcountry (only for this method)
validateIbanIBANAO06123456789012345678901123456country (only for this method)
validatePassportPassportA1234567XYZ12country (only for this method)
validatePhoneCountryCodePhone country code+244923456789+000000000000phoneCountryCode (only for this method)

🎓 License

MIT © 2025 - Kaike Bartolomeu

Keywords

validated

FAQs

Package last updated on 06 Mar 2025

Did you know?

Socket

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.

Install

Related posts

SocketSocket SOC 2 Logo

Product

About

Packages

Stay in touch

Get open source security insights delivered straight into your inbox.

  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc

U.S. Patent No. 12,346,443 & 12,314,394. Other pending.