Skip to the content

address-plusアドレスプラス

Parse, validate, format and compare addresses locally, add country modules and mount an optional native form field.

address-plus extends the parse-address style with typed results, validation, formatting and country modules. About the name

Contents

Reference · Parsing, formatting and shared types

parseStreetNumberfunction

Takes the house number off the start of a street line, with a fraction or a letter if it has one.

Import it

import { parseStreetNumber } from "@johnmorrisdotca/address-plus";

Definition

function parseStreetNumber(text: string): { number: string | undefined; remaining: string; }

Parameters

NameTypeDescription
textstring

The street line.

Returns

{ number: string | undefined; remaining: string; }

The number (undefined when there is none) and the text that remains.

Examples

import { parseStreetNumber } from "@johnmorrisdotca/address-plus";

console.log(parseStreetNumber("123 Main St"));
// → {"number":"123","remaining":"Main St"}
{ number: '123', remaining: 'Main St' }

What it prints (run when this page was built)

View sourceEdit on GitHubMade from the source of @johnmorrisdotca/address-plus 1.7.0.