@loadsmart/utils-geolocation
TypeScript icon, indicating that this package has built-in type declarations

0.3.1 • Public • Published

BundlePhobia BundlePhobia

utils-geolocation

useful functions for dealing with geolocation data

Install via NPM

$ npm i @loadsmart/utils-geolocation --save

Install via yarn

$ yarn add @loadsmart/utils-geolocation

Usage

import React from 'react'
import {
  isValidGeoSuggestion
} from '@loadsmart/utils-geolocation'

export default ({geoData}) => (
  <div>
    { isValidGeoSuggestion(geoSuggestionData) ? <Map data={geoData} /> : <Error /> }
  </div>
)

Available Functions

These are the functions available at this library:

gMapsToAddressComponentsObject(gmaps, config)

Converts a gmaps object containing the adress_components field to an object in the form:

{
  "city": "City Name",
  "state": "ST",
  "country": "CT",
  "zipcode": "00000"
}

isValidGeoSuggestion(geoSuggestion)

Checks if the passed geoSuggestion is a valid geo suggestion object, containing all required fields (location, gmaps, and description), returns a boolean.

Dependencies (0)

    Dev Dependencies (0)

      Package Sidebar

      Install

      npm i @loadsmart/utils-geolocation

      Weekly Downloads

      95

      Version

      0.3.1

      License

      MIT

      Unpacked Size

      9.85 kB

      Total Files

      12

      Last publish

      Collaborators

      • felipe.asantos
      • giovannitoledo
      • douglasklein2
      • luiz.loadsmart
      • mwconceicao
      • yidi0912
      • lenoir.zamboni
      • diogomafra
      • oliver.tso
      • loadsmart-frontend
      • brennervaz
      • raittes
      • welingtonms-loadsmart
      • gutofoletto