Reference · Parsing, formatting and shared types
AddressParsingTestCasetype
A parsing case in the package's JSON test files: an address and the fields expected from it.
Import it
import type { AddressParsingTestCase } from "@johnmorrisdotca/address-plus";
Definition
interface AddressParsingTestCase extends TestCaseBase {
input: string;
expected: {
number?: string;
prefix?: string;
street?: string;
type?: string;
suffix?: string;
city?: string;
state?: string;
zip?: string;
country?: string;
[key: string]: unknown;
};
options?: {
strict?: boolean;
country?: string;
[key: string]: unknown;
};
}
Members
| Name | Type | Description |
|---|---|---|
input | string | |
expected | { [key: string]: unknown; number?: string; prefix?: string; street?: string; type?: string; suffix?: string; city?: string; state?: string; zip?: string; country?: string; } | |
options (optional) | { [key: string]: unknown; strict?: boolean; country?: string; } | undefined | |
name (optional) | string | undefined | |
description (optional) | string | undefined |
Examples
import type { AddressParsingTestCase } from "@johnmorrisdotca/address-plus";
console.log(({ input: "123 Main St, Anytown, NY 12345", expected: { number: "123", state: "NY" } }).expected.state);
// → "NY"NYWhat it prints (run when this page was built)