https://github.com/bendrucker/zippo
ZIP code validation and parsing
https://github.com/bendrucker/zippo
Last synced: over 1 year ago
JSON representation
ZIP code validation and parsing
- Host: GitHub
- URL: https://github.com/bendrucker/zippo
- Owner: bendrucker
- License: mit
- Created: 2015-07-29T17:47:47.000Z (almost 11 years ago)
- Default Branch: master
- Last Pushed: 2019-08-19T21:46:42.000Z (almost 7 years ago)
- Last Synced: 2025-04-15T00:02:38.433Z (over 1 year ago)
- Language: JavaScript
- Homepage:
- Size: 4.88 KB
- Stars: 4
- Watchers: 2
- Forks: 0
- Open Issues: 1
-
Metadata Files:
- Readme: readme.md
- License: license
Awesome Lists containing this project
README
# zippo [](https://travis-ci.org/bendrucker/zippo) [](https://greenkeeper.io/)
> ZIP code validation and parsing
## Install
```
$ npm install --save zippo
```
## Usage
```js
var zip = require('zippo')
zip.parse('94105abc123')
//=> 94105
zip.validate('94105abc123')
//=> false
```
## API
#### `zip.parse(input)` -> `string`
Parses a zip code input by removing non-digit characters and limiting the string to 5 characters.
##### input
*Required*
Type: `string`
#### `zip.validate(input)` -> `boolean`
Validates whether a zip code is 5 digits.
##### input
*Required*
Type: `string`
## License
MIT © [Ben Drucker](http://bendrucker.me)