4.2.0 • Published 2 years ago

dad-tool v4.2.0

Weekly downloads
18
License
MIT
Repository
github
Last release
2 years ago

Dummy Address Data (DAD) Node Library

Dummy Address Data (DAD) - Retrieve real addresses from all around the world.

Build Status Coverage Status NPM Licence

The DAD Node library is the perfect companion to quickly bootstrap address data in your application. DAD provides real addresses from all over the world with a consistent data structure so you can spend less time looking up addresses and address rules and more time coding. Rigorously tested with 2000+ tests, rest easy knowing your address data is uniform, accurate, and performant.

Install

# Install globally for CLI implementation
npm i -g dad-tool

# Install locally for package implementation
npm i dad-tool

Address Data

Address objects will look like the sample below. The data type of each field on an address object is a string. A list of addresses is an array of json objects.

Attempts have been made to verify addresses and ensure that street1, city, state, and zip are present on all records. Some lists may be shorter than others to avoid complexity or because of a lack of accurate data.

The following files can be found in the data directory.

Australia

LocationsTag
Victoria AreaAU_VT

Canada

LocationsTag
BC AreaCA_BC

China

LocationsTag
Beijing AreaCN_BJ
Hong Kong - Wan Chai AreaCN_HK

Europe

LocationsTag
Germany - Wesel AreaEU_DE
Spain - CountrywideEU_ES
France - Paris AreaEU_FR
United Kingdom - England AreaEU_UK

Mexico

LocationsTag
Mexico - Mexico City AreaMX_MX

United States

LocationsTag
Arizona - Gilbert AreaUS_AZ
California - Anaheim AreaUS_CA
Idaho - Boise AreaUS_ID
Kansas - Barton CountyUS_KS
Nevada - Lincoln AreaUS_NV
New York - Rochester AreaUS_NY
Oregon - Portland AreaUS_OR
Texas - Austin AreaUS_TX
Utah - Provo AreaUS_UT
Washington - Spokane AreaUS_WA

Usage

CLI Implementation

# Returns a random address from a list to console
dad US_UT

Package Implementation

const dad = require('dad-tool')

// Grab a random UT address
const address = dad.random('US_UT')
console.log(address)

// Alternatively, grab the entire UT list
const addresses = dad.list('US_UT')
console.log(addresses)

// Print to console or do whatever you'd like with the address data
console.log(address.city)

// Get the list of all ISO country codes
const isoData = dad.isoCountryCodes()
for (let i = 0; i < isoData.length; i++) {
    console.log(JSON.stringify(isoData[i], null, 4))
}

Sample Address Object

A sample address object will look like the following:

{
    "street1": "231 N 1200 W",
    "street2": "UNIT 104",
    "city": "OREM",
    "state": "UT",
    "zip": "84057",
    "country": "US"
}

Sample ISO Country Object

{
    "country": "United States of America",
    "alpha_2_code": "US",
    "alpha_3_code": "USA"
}

Development

# Lint the project
npm run lint

# Run tests
npm run test

# Run test coverage
npm run coverage

# Update the DAD data files
git submodule init && git submodule update --remote dad

Attribution

  • Addresses provided by DAD.
4.2.0

2 years ago

4.1.0

3 years ago

4.0.0

3 years ago

3.1.0

3 years ago

3.0.0

3 years ago

2.6.0

3 years ago

2.5.0

4 years ago

2.4.0

4 years ago

2.3.2

4 years ago

2.3.1

4 years ago

2.3.0

4 years ago

2.2.1

4 years ago

2.2.0

4 years ago

2.1.1

4 years ago

2.1.0

4 years ago

2.0.1

4 years ago

2.0.0

4 years ago

1.0.2

4 years ago

1.0.1

4 years ago

0.1.1

4 years ago

0.1.0

4 years ago