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.

30 lines (29 loc) 857 B
/** * Pure routing decision used by every routed adapter. Adapters do their own * path normalization (Netlify strips `/.netlify/functions/<name>`, Vercel + * Azure use `/api/...`, AWS uses raw `/...`) and then ask `classifyRoute` to * decide what to do. * * Centralising the decision tree means a new endpoint (say `/cache/clear`) * lands in one place instead of six. */ export type Route = { kind: 'preflight'; } | { kind: 'health'; } | { kind: 'validate-single'; } | { kind: 'validate-batch'; } | { kind: 'method-not-allowed'; } | { kind: 'not-found'; }; export declare function classifyRoute(path: string, method: string): Route; /** Standard healthy-status payload used by every adapter. */ export declare function healthPayload(platform: string): { status: 'healthy'; platform: string; timestamp: string; };