@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.
28 lines (27 loc) • 1.04 kB
TypeScript
/**
* Generic KV-shaped loader. The interface (`get(key, type) -> ArrayBuffer`)
* matches Cloudflare Workers KV exactly and is close enough to fit Vercel
* Edge Config / Upstash Redis / DynamoDB DAX after a tiny shim.
*
* Resources are stored under a configurable prefix so multiple datasets can
* share the same namespace without collisions.
*/
import type { ResourceLoader } from '../../types';
/** Minimal KV surface — Workers KV implements this natively. */
export interface KvNamespace {
get(key: string, type: 'arrayBuffer'): Promise<ArrayBuffer | null>;
}
export interface KvResourceLoaderOptions {
namespace: KvNamespace;
/**
* Prepended to every key (e.g. `phone-validator:geocodes/en/41.bson`).
* Defaults to `phone-validator:`.
*/
prefix?: string;
}
export declare class KvResourceLoader implements ResourceLoader {
private readonly namespace;
private readonly prefix;
constructor(options: KvResourceLoaderOptions);
loadResource(path: string): Promise<Uint8Array | null>;
}