Giter Site home page Giter Site logo

justintime50 / dad-node Goto Github PK

View Code? Open in Web Editor NEW
10.0 3.0 0.0 631 KB

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

Home Page: https://github.com/justintime50/dad

License: MIT License

JavaScript 100.00%
dummy dummy-data address data dad dataset real retrieving-addresses addresses world

dad-node's Introduction

Dummy Address Data (DAD) Node Library

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

Build Status Coverage Status NPM Licence

Showcase

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

Locations Tag
Victoria Area AU_VT

Canada

Locations Tag
BC Area CA_BC

China

Locations Tag
Beijing Area CN_BJ
Hong Kong - Wan Chai Area CN_HK

Europe

Locations Tag
Germany - Wesel Area EU_DE
Spain - Countrywide EU_ES
France - Paris Area EU_FR
United Kingdom - England Area EU_UK

Mexico

Locations Tag
Mexico - Mexico City Area MX_MX

United States

Locations Tag
Arizona - Gilbert Area US_AZ
California - Anaheim Area US_CA
Idaho - Boise Area US_ID
Kansas - Barton County US_KS
Nevada - Lincoln Area US_NV
New York - Rochester Area US_NY
Oregon - Portland Area US_OR
Texas - Austin Area US_TX
Utah - Provo Area US_UT
Washington - Spokane Area US_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.

dad-node's People

Contributors

dependabot[bot] avatar justintime50 avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar

dad-node's Issues

Add ISO Country Information

It would be cool to be able to retrieve information about countries of the world in addition to addresses. Include ISO country codes and other interesting data.

Write tests to ensure all records are uniform

We should write a test to ensure every single record contains keys for:

  • street1
  • street2
  • city
  • state
  • zip
  • country

Even if they are empty, the keys should exist for every record to ensure they are all uniform.

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.