richorama / country-code-lookup

:earth_africa: Finds countries by various country codes

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

state is null when address ends with "-1234"

dekelev opened this issue · comments

Hi, awesome library! I found some issue with postal codes that has dash in them.

state is null when address ends with "-1234", for example:

(async function () {
  const util = require('util')
  const parseAddressCallback = require('parse-address-string')
  const parseAddress = util.promisify(parseAddressCallback)

  const address = await parseAddress('1234 Road St, Brooklyn, NY 12345-1234')

  console.log(address)
})()

Will result with:

{
  street_address1: '1234 Road St',
  city: 'Brooklyn',
  state: null,
  postal_code: '12345',
  country: null
}

country-code-lookup version: 0.0.19
NodeJS version: 14.16.1

Hey, thanks for raising an excellent issue with the steps to reproduce!

However, I suspect that the issue lies with the parse-address-string package, as this library only deals with counties, and doesn't know anything about postcodes or addresses.

Thanks, I posted it on the wrong repo :)