hassansin / parse-address

US Street Address Parser
http://hassansin.github.io/parse-address/
Other
157 stars 81 forks source link

Feature Request: skip address normalization step #23

Open fishybell opened 5 years ago

fishybell commented 5 years ago

When using the address parser, I would like an option for skipping the abbreviating of address components like state and street type.

For example:

var parser = require('parse-address');
var parsed = parser.parseLocation('1005 N Gravenstein Highway Sebastopol CA 95472');

// produces...
{ number: '1005',
  prefix: 'N',
  street: 'Gravenstein',
  type: 'Hwy',
  city: 'Sebastopol',
  state: 'CA',
  zip: '95472' }

With the new feature, all sub-strings would remain unmodified if desired:

var parser = require('parse-address');
var parsed = parser.parseLocation('1005 N Gravenstein Highway Sebastopol CA 95472',
                                  skipAbbrev=true); // or some other flag to skip abbreviation

// produces...
{ number: '1005',
  prefix: 'N',
  street: 'Gravenstein',
  type: 'Highway', // doesn't abbreviate
  city: 'Sebastopol',
  state: 'CA', // leaves abbreviated
  zip: '95472' }