Comments (4)
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.
@phosfake Are you planning to add above types to DefinitelyTyped?
from parse-address.
A DefinitelyTyped package would be much appreciated
from parse-address.
Plus one to adding type file.
from parse-address.
Related Issues (20)
- Doesn't identify 9 digit zips HOT 3
- Returns null if string contains "&" or "@" HOT 1
- address without street will interpret city as street
- Issue when it find 2 possible street type HOT 2
- Undefined is not a function.
- Feature Request: skip address normalization step
- Adding country at the end of an address makes parsed address set city to street and street to prefix HOT 1
- Parse-address is too awesome. Please reduce it's awesomeness so other options don't suck so much. HOT 1
- Are there any plans to support other countries (ie: Canada)? HOT 2
- [Bug] Parses following address incorrectly "'4505 ravenwood pl union city ga" HOT 1
- [Bug] parseLocation removes apostrophes from city names
- Addresses without Unit label drop unit number
- Using # as secondary designator results in inconsistent behavior
- Certain addresses in Alaska, USA are showing strange behavior
- [Bug] ParseLocation not returning "/" in the given addresses HOT 1
- Unit test fails
- Ignoring alphabets from the home number "21B-Mercury-Drive-Londonderry-NH-03053"
- [Bug] United State address parse error
- PO box without a street address HOT 1
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
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.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from parse-address.