An open API service indexing awesome lists of open source software.

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

Awesome Lists containing this project

README

          

# zippo [![Build Status](https://travis-ci.org/bendrucker/zippo.svg?branch=master)](https://travis-ci.org/bendrucker/zippo) [![Greenkeeper badge](https://badges.greenkeeper.io/bendrucker/zippo.svg)](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)