@panda-clouds/address-formatter
v2.4.2
Published
Standardizes addresses from user input strings
Downloads
20
Readme
PCAddressFormatter
maintained by PandaClouds.com
PCAddressFormatter
is a lightweight JavaScript library for Node.js that provides formatting of postal addresses.
Installation
If you want to use this library, you first need to install the Node.js.
When you install node.js, will also be installed npm.
Please run the following command.
npm install --save @panda-clouds/address-formatter
Usage
Node.js
const PCAddressFormatter = require('@panda-clouds/address-formatter');
// example usage
PCAddressFormatter.street('123 North Happy Street'); // => '123 N Happy St';
PCAddressFormatter.city('San Antonio'); // => 'San Antonio';
PCAddressFormatter.state('Arizona'); // => 'AZ';
PCAddressFormatter.country('United States of America'); // => 'US';
PCAddressFormatter.zipCode(85234); // => '85234';
You can replace PCAddressFormatter with any variable.
Methods
Unit Tests are an additional resource for learning functionality.
- street(input)
Example:
PCAddressFormatter.street('123 North Happy Street'); // => '123 N Happy St;
- city(input)
Example:
PCAddressFormatter.city('San Antonio'); // => 'San Antonio';
- state(input)
Example:
PCAddressFormatter.state('Arizona'); // => 'AZ';
- country(input)
Example:
PCAddressFormatter.country('United States of America'); // => 'US';
- zipcode(input)
Example:
PCAddressFormatter.zipcode(85234); // => '85234';
Contributions
Pull requests are welcome! here is a checklist to speed things up:
- modify
PCAddressFormatter.js
- add unit tests in
PCAddressFormatter.spec.js
- run
npm test
- document method in
README.md
- add your name to 'Contributors' in
README.md
Contributors
(Add your name)
- [*] Marc Smith