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

DIRECTIONAL_MAPconstant

Each directional word, in English or French, in lower case, to its abbreviation (northwest and nord-ouest to NW and NO).

Import it

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

Definition

const DIRECTIONAL_MAP: Record<string, string> = {
    east: "E",
    north: "N",
    northeast: "NE",
    northwest: "NW",
    south: "S",
    southeast: "SE",
    southwest: "SW",
    west: "W",
    e: "E",
    n: "N",
    ne: "NE",
    nw: "NW",
    s: "S",
    se: "SE",
    sw: "SW",
    w: "W",
    "e.": "E",
    "n.": "N",
    "n.e.": "NE",
    "ne.": "NE",
    "n.w.": "NW",
    "nw.": "NW",
    "s.": "S",
    "s.e.": "SE",
    "se.": "SE",
    "s.w.": "SW",
    "sw.": "SW",
    "w.": "W",
    "E.": "E",
    "N.": "N",
    "S.": "S",
    "W.": "W",
    "S.E.": "SE",
    "S.W.": "SW",
    "N.E.": "NE",
    "N.W.": "NW",
    est: "E",
    nord: "N",
    "nord-est": "NE",
    "nord-ouest": "NO",
    ouest: "O",
    o: "O",
    sud: "S",
    "sud-est": "SE",
    "sud-ouest": "SO",
    "o.": "O",
    "n.-o.": "NO",
    "n.-e.": "NE",
    "s.-o.": "SO",
    "s.-e.": "SE",
    "N.-O.": "NO",
    "N.-E.": "NE",
    "S.-O.": "SO",
    "S.-E.": "SE",
}

Examples

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

console.log(DIRECTIONAL_MAP["northwest"]);
// → "NW"
NW

What it prints (run when this page was built)

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