New Case Study:See how Anthropic automated 95% of dependency reviews with Socket.Learn More
Socket
Sign inDemoInstall
Socket

google-places-address-normalizer

Package Overview
Dependencies
Maintainers
1
Versions
4
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

google-places-address-normalizer

*Quick Start:*

  • 1.0.3
  • latest
  • npm
  • Socket score

Version published
Maintainers
1
Created
Source

Google Places Address Normalizer

Quick Start:

npm install google-places-address-normalizer --save

or

yarn add google-places-address-normalizer

Sample Code:

import googlePlacesNormalizer from 'google-places-address-normalizer';

let placesService = new window.google.maps.places.PlacesService(document.getElementById('placesService'));

let placesService.getDetails({
  placeId: '123' // some place_id,
}, (place, status) => {
  if (status === window.google.maps.places.PlacesServiceStatus.OK) {
    const normalizedAddress = googlePlacesNormalizer(place.address_components);
    // ... do something with normalizedAddress
  }
});

Example input:

[{
    "long_name": "916",
    "short_name": "916",
    "types": ["street_number"]
}, {
    "long_name": "Kearny Street",
    "short_name": "Kearny St",
    "types": ["route"]
}, {
    "long_name": "Financial District",
    "short_name": "Financial District",
    "types": ["neighborhood", "political"]
}, {
    "long_name": "San Francisco",
    "short_name": "SF",
    "types": ["locality", "political"]
}, {
    "long_name": "San Francisco County",
    "short_name": "San Francisco County",
    "types": ["administrative_area_level_2", "political"]
}, {
    "long_name": "California",
    "short_name": "CA",
    "types": ["administrative_area_level_1", "political"]
}, {
    "long_name": "United States",
    "short_name": "US",
    "types": ["country", "political"]
}, {
    "long_name": "94133",
    "short_name": "94133",
    "types": ["postal_code"]
}, {
    "long_name": "5107",
    "short_name": "5107",
    "types": ["postal_code_suffix"]
}]

Example output:

{
  "address": "916 Kearny Street",
  "neighborhood": "Financial District",
  "city": "San Francisco",
  "county": "San Francisco County",
  "state": "California",
  "state_abbreviation": "CA",
  "country": "United States",
  "country_abbreviation": "US",
  "postal_code": "94133",
  "postal_code_suffix": "5107"
}

License

MIT

Keywords

FAQs

Package last updated on 25 Jan 2017

Did you know?

Socket

Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.

Install

Related posts

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc