UNPKG

@sroussey/parse-address

Version:

International street address parser for 220 jurisdictions (US, CA + 218 countries and territories), with SEC EDGAR country-code resolution

51 lines (50 loc) 2.32 kB
import { AddressParserImpl } from "../../types/parser.js"; import type { EuCountryConfig } from "./types.js"; /** * Generic, configuration-driven parser for European addresses. One instance per * country, built from an `EuCountryConfig`. Implements the same surface as the * US/CA parsers so it drops straight into the `AddressParser` facade. */ export declare class AddressParserEU implements AddressParserImpl { readonly config: EuCountryConfig; private readonly ruleset; private readonly poAnywhereRe; private readonly fusedSuffixesSorted; private readonly unsplittablePrefixRe; private lastDropped; constructor(config: EuCountryConfig); parseAddress(address: string): Record<string, any> | null; parseStreet(streetaddress: string): Record<string, any> | null; parseInformalAddress(address: string): Record<string, any> | null; parsePoAddress(address: string): Record<string, any> | null; parseLocation(address: string): Record<string, any> | null; parseIntersection(_address: string): null; droppableTokens(): string[]; findStreetTypeShortCode(streetType?: string): string; normalizeAddress(parts: Record<string, any> | null): Record<string, any> | null; /** * Tidy a civic-number suffix: collapse whitespace around a range dash * ("24 - 26" -> "24-26") and trim the ends, but keep an internal space in * markers like the Spanish "km 176". */ private normalizeNumberSuffix; /** Trim surrounding whitespace/commas while preserving accents and casing. */ private cleanValue; /** * Peel a glued street type off the end of the name (DE/NL "Bäckerstraße"). * Runs for any country that supplies `fusedTypeSuffixes` -- including * mixed-grammar countries (BE/CH) whose `prefix` French/Italian streets are * already typed (so this is a no-op there) but whose Dutch/German streets * arrive here untyped. */ private applyFusedType; /** "The" + suffix type ("The Broadway") is one whole name, not a split. */ private foldArticleType; /** Canonicalise the street type display form and compute its short code. */ private normalizeType; private normalizeSecUnit; private normalizePostal; private normalizeRegion; private tidyCity; private titleCase; }