Simple address formatting for the masses
address: '1234 Some St.'address2: 'Floor #67'address3: 'Unit #123'city: 'San Francisco'subdivision: 'CA'postalCode: '94105'countryCode: 'US'
'1234 Some St.''Floor #67''Unit #123''San Francisco, CA 94105'
If a line does not have any information, it will be omitted.
Use in Node.js
No additional work necessary. This package is not currently published to npm, but will be very soon.
Building for use in browser
I've included a build script for a standalone browserify module. To build, simply run the following from CLI:
npm installnpm run build
dist/address-format.js and uglify to
dist/address-format.min.js. Include whichever you like.
Gladly accepting contributions, hopefully in the form of additional countries. Regardless of current tests being a bit naive, please include tests for added countries to ensure the output is as expected.