Sparticuz / usps-webtools-promise

USPS Web Tools API wrapper
14 stars 4 forks source link

Address1 and Address2 are being swapped #22

Closed bquay closed 11 months ago

bquay commented 1 year ago

I'm running into some issue where Address1 and Address2 are being swapped unbeknownst to me. Looking through the code it seems like there's a few places where this is happening. Was this intentional? If so, I suppose I can create a workaround. If not, I'm more than happy to put up a PR!

https://github.com/Sparticuz/usps-webtools-promise/blob/d6d57c9a8e1b8d784701d408e35b7494300c42a1/src/address-validate.ts#L50

https://github.com/Sparticuz/usps-webtools-promise/blob/d6d57c9a8e1b8d784701d408e35b7494300c42a1/src/address-validate.ts#L74

https://github.com/Sparticuz/usps-webtools-promise/blob/d6d57c9a8e1b8d784701d408e35b7494300c42a1/src/lookups/zip-code-lookup.ts#L46

Sparticuz commented 11 months ago

Yep, it's intentional. The USPS returns something like { "Address1": "Suite 250", "Address2": "123 Street Address" }, but I think generally most people use the opposite.