UNPKG

@phonecheck/phone-number-validator-js

Version:

Validate, parse, and enrich international phone numbers — geocoding, carrier lookup, and timezone resolution. Sync (Node) + async (serverless) APIs, platform adapters, and a CLI.

24 lines (23 loc) 852 B
/** * Helpers for Lambda-shaped runtimes (AWS API Gateway proxy events, Netlify * Functions, classic GCP). Bodies arrive as strings (optionally base64) and * responses are `{ statusCode, headers, body: string }` shapes. */ export interface LambdaLikeEvent { body: string | null; isBase64Encoded?: boolean; } export interface LambdaResult { statusCode: number; headers?: { [key: string]: string; }; body: string; } /** * Decode an API Gateway / Netlify body, supporting base64 payloads. Throws * `SyntaxError` on malformed JSON so callers can map it to a 400 cleanly. */ export declare function decodeLambdaBody(event: LambdaLikeEvent): unknown; /** Lambda-shaped JSON response shorthand. */ export declare function lambdaResponse(statusCode: number, body: unknown, headers: Record<string, string>): LambdaResult;