zippity-do-dah is a collection of data and utilities to lookup postal-code based location information.
Functions for looking up zipcode, city, state, latitude and longitude using a zipcode, city + state, or latitude + longitude. You can also get random sets of this data.
Data sourced from federalgovernmentzipcodes.us. This is primary data, meaning data that maps to multiple locations will return only the primary location.
var zipdb = require('zippity-do-dah');
console.log(zipdb.random());
// {zipcode: '76626', type: 'standard', city: 'Blooming Grove', state: 'TX', latitude: '32.09', longitude: '-96.71' }
console.log(zipdb.zipcode('76626'));
// {zipcode: '76626', type: 'standard', city: 'Blooming Grove', state: 'TX', latitude: '32.09', longitude: '-96.71' }
console.log(zipdb.citystate('Blooming Grove', 'TX'));
// {zipcode: '76626', type: 'standard', city: 'Blooming Grove', state: 'TX', latitude: '32.09', longitude: '-96.71' }
console.log(zipdb.latlong('32.09', '-96.71'));
// {zipcode: '76626', type: 'standard', city: 'Blooming Grove', state: 'TX', latitude: '32.09', longitude: '-96.71' }
Return the version of this library.
All lookups will return an empty object (if lookup was unsuccessful) or object with the following properties:
- zipcode
- type (standard, military, po box)
- city
- state
- latitude
- longitude
These properties may be empty if not applicable to the specific location returned. Each lookup has a synchronous and asynchronous function signature. If the final argument is a callback function of the form function(err, data), err will be set if lookup fails.
Lookup data by 5 digit zipcode
Lookup data by city and state, capitalization does not matter.
Lookup date by latitude and longitude, lat/long must have two decimal digits only (-)xx.xx.
Will return a single random result, if number is specified and > 1 will return an array of random results.