Giter VIP home page Giter VIP logo

Comments (4)

phosfake avatar phosfake commented on July 25, 2024 5

I used the following typescript definition internally in my project. I extracted it from the Perl library docs that this package ports (Geo::StreetAddress::US)

Can we get some feedback from the contributors on the accuracy?
I'm willing to add this to DefinitelyTyped if we do. I had to comment out the "intersection specifier" because I wasn't sure if it was populated in this package.

declare module 'parse-address' {
  export function parseLocation(address: string): StreetAddress;

  export class StreetAddress {
    /**
     * House or street number.
     * @type {string}
     */
    number?: string;

    /**
     * Directional prefix for the street, such as N, NE, E, etc. A given prefix should be one to two characters long.
     * @type {string}
     */
    prefix?: string;

    /**
     * Name of the street, without directional or type qualifiers.
     * @type {string}
     */
    street?: string;

    /**
     * Abbreviated street type, e.g. Rd, St, Ave, etc. See the USPS official type abbreviations at http://pe.usps.com/text/pub28/pub28apc.html for a list of abbreviations used.
     * @type {string}
     */
    type?: string;

    /**
     * Directional suffix for the street, as above.
     * @type {string}
     */
    suffix?: string;

    /**
     * Name of the city, town, or other locale that the address is situated in.
     * @type {string}
     */
    city?: string;

    /**
     * The state which the address is situated in, given as its two-letter postal abbreviation. for a list of abbreviations used.
     * @type {string}
     */
    state?: string;

    /**
     * Five digit ZIP postal code for the address, including leading zero, if needed.
     * @type {string}
     */
    zip?: string;

    /**
     * If the address includes a Secondary Unit Designator, such as a room, suite or appartment, the sec_unit_type field will indicate the type of unit.
     * @type {string}
     */
    sec_unit_type?: string;

    /**
     * If the address includes a Secondary Unit Designator, such as a room, suite or appartment, the sec_unit_num field will indicate the number of the unit (which may not be numeric).
     * @type {string}
     */
    sec_unit_num?: string;

    // INTERSECTION_SPECIFIER
    // https://metacpan.org/release/TIMB/Geo-StreetAddress-US-1.04/view/US.pm#INTERSECTION-SPECIFIER

    // /**
    //  * Directional prefixes for the streets in question.
    //  * @type {string}
    //  */
    // prefix1?: string;

    // /**
    //  * Directional prefixes for the streets in question.
    //  * @type {string}
    //  */
    // prefix2?: string;

    // /**
    //  * Names of the streets in question.
    //  * @type {string}
    //  */
    // street1?: string;

    // /**
    //  * Names of the streets in question.
    //  * @type {string}
    //  */
    // street2?: string;

    // /**
    //  * Street types for the streets in question.
    //  * @type {string}
    //  */
    // type1?: string;

    // /**
    //  * Street types for the streets in question.
    //  * @type {string}
    //  */
    // type2?: string;

    // /**
    //  * Directional suffixes for the streets in question.
    //  * @type {string}
    //  */
    // suffix1?: string;

    // /**
    //  * Directional suffixes for the streets in question.
    //  * @type {string}
    //  */
    // suffix2?: string;

    // /**
    //  * City or locale containing the intersection, as above.
    //  * @type {string}
    //  */
    // city?: string;

    // /**
    //  * State abbreviation, as above.
    //  * @type {string}
    //  */
    // state?: string;

    // /**
    //  * Five digit ZIP code, as above.
    //  * @type {string}
    //  */
    // zip?: string;
  }
}

from parse-address.

serrg avatar serrg commented on July 25, 2024 1

@phosfake Are you planning to add above types to DefinitelyTyped?

from parse-address.

roofleDev avatar roofleDev commented on July 25, 2024

A DefinitelyTyped package would be much appreciated

from parse-address.

draperj avatar draperj commented on July 25, 2024

Plus one to adding type file.

from parse-address.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.