GithubHelp home page GithubHelp logo

sam-zip-city's Introduction

SAM zip-city

This library aims to do city lookups in a fast (client-side), generic way.

The script will dynamically load the appropriate file with zipcodes and city names for a given country.

This allows for smaller bundle size and means that the file(s) are only downloaded when needed.

How to install

npm install @omnicar/sam-zip-city or yarn add @omnicar/sam-zip-city

FAQ

Question:

But are all the zip code files inside the imported package?

Answer: No, only the file(s) with the postal codes (zip codes) of the requested country are retrieved dynamically at run time.

Question:

From where are the file(s) with the postal codes (zip codes) fetched from?

Answer: The postal codes are fetched from admin dot omnicar dot io slash data slash zip-codes slash


How to use

import { getCityFromZip } from '@omnicar/sam-zip-city'

const myFunc = async () => {
  const city = await getCityFromZip({
    zipcode: 2300,
    country: 'DK' 
  })
  console.log(city)
}

Or to initialise a country before requesting a city:

import { initZipCityCountry } from '@omnicar/sam-zip-city'

const myOtherFunc = async () => {
  await initZipCityCountry({ country: 'DK' })
  console.log('Danish zipcodes and cities should be ready!')
}

sam-zip-city's People

Contributors

amoskodare avatar erik-beus avatar fragusmarko avatar mkock avatar renovate-bot avatar renovate[bot] avatar richban avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar

Forkers

erik-beus

sam-zip-city's Issues

Dependency Dashboard

This issue lists Renovate updates and detected dependencies. Read the Dependency Dashboard docs to learn more.

Edited/Blocked

These updates have been manually edited so Renovate will no longer make changes. To discard all commits and start over, click on a checkbox.

Open

These updates have all been created already. Click a checkbox below to force a retry/rebase of any.

Detected dependencies

circleci
.circleci/config.yml
npm
package.json
  • node-fetch ^2.6.11
  • tslib ^1.9.3
  • @types/node-fetch ^2.6.4
  • @omnicar/sam-types 0.0.641
  • @types/jest 24.0.11
  • @types/node ^11.13.0
  • jest ^24.7.0
  • ts-jest ^24.0.1
  • typescript ^4.1.6
nvm
.nvmrc
  • node 10.15.3

  • Check this box to trigger a request for Renovate to run again on this repository

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.