@takentrade/takentrade-libs
Version:
TakeNTrade shared libraries
63 lines (62 loc) • 1.93 kB
TypeScript
/**
* Validation utilities for common Nigerian/African fintech use cases
*/
/**
* Validates Nigerian phone number
* Accepts formats: 08012345678, +2348012345678, 2348012345678
*/
export declare const isValidNigerianPhone: (phone: string) => boolean;
/**
* Validates email address
*/
export declare const isValidEmail: (email: string) => boolean;
/**
* Validates Nigerian BVN (Bank Verification Number)
* Must be exactly 11 digits
*/
export declare const isValidBVN: (bvn: string) => boolean;
/**
* Validates Nigerian NIN (National Identification Number)
* Must be exactly 11 digits
*/
export declare const isValidNIN: (nin: string) => boolean;
/**
* Validates Nigerian account number
* Must be exactly 10 digits (NUBAN format)
*/
export declare const isValidAccountNumber: (accountNumber: string) => boolean;
/**
* Validates amount (must be positive number)
*/
export declare const isValidAmount: (amount: number) => boolean;
/**
* Validates password strength
* At least 8 characters, 1 uppercase, 1 lowercase, 1 number
*/
export declare const isStrongPassword: (password: string) => boolean;
/**
* Validates referral code format
* 6-10 alphanumeric characters
*/
export declare const isValidReferralCode: (code: string) => boolean;
/**
* Validates transaction reference format
*/
export declare const isValidTransactionReference: (ref: string) => boolean;
/**
* Sanitizes phone number to standard format
* Converts to: 2348012345678
*/
export declare const sanitizePhoneNumber: (phone: string, withPlus?: boolean) => string;
/**
* Validates date is not in the past
*/
export declare const isNotPastDate: (date: Date) => boolean;
/**
* Validates date is within range
*/
export declare const isDateInRange: (date: Date, minDate: Date, maxDate: Date) => boolean;
/**
* Validates age is above minimum (for KYC)
*/
export declare const isValidAge: (dateOfBirth: Date, minAge?: number) => boolean;