Huge News!Announcing our $40M Series B led by Abstract Ventures.Learn More
Socket
Sign inDemoInstall
Socket

expo-location

Package Overview
Dependencies
Maintainers
17
Versions
122
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

expo-location - npm Package Compare versions

Comparing version 6.0.0 to 7.0.0-rc.0

.eslintrc.js

2

build/Location.d.ts

@@ -89,3 +89,3 @@ import { EventEmitter } from '@unimodules/core';

}
export { LocationAccuracy as Accuracy, LocationActivityType as ActivityType, };
export { LocationAccuracy as Accuracy, LocationActivityType as ActivityType };
export declare enum GeofencingEventType {

@@ -92,0 +92,0 @@ Enter = 1,

@@ -1,6 +0,5 @@

import { EventEmitter, Platform } from '@unimodules/core';
import { EventEmitter, Platform, CodedError } from '@unimodules/core';
import invariant from 'invariant';
import ExpoLocation from './ExpoLocation';
const LocationEventEmitter = new EventEmitter(ExpoLocation);
;
var LocationAccuracy;

@@ -23,3 +22,3 @@ (function (LocationAccuracy) {

})(LocationActivityType || (LocationActivityType = {}));
export { LocationAccuracy as Accuracy, LocationActivityType as ActivityType, };
export { LocationAccuracy as Accuracy, LocationActivityType as ActivityType };
export var GeofencingEventType;

@@ -167,3 +166,3 @@ (function (GeofencingEventType) {

if (!googleApiKey) {
throw new Error(error.message + ' Please set a Google API Key to use geocoding.');
throw new CodedError(error.code, `${error.message} Please set a Google API Key to use geocoding.`);
}

@@ -183,3 +182,3 @@ return _googleGeocodeAsync(address);

if (!googleApiKey) {
throw new Error(error.message + ' Please set a Google API Key to use geocoding.');
throw new CodedError(error.code, `${error.message} Please set a Google API Key to use geocoding.`);
}

@@ -197,9 +196,6 @@ return _googleReverseGeocodeAsync(location);

const resultObject = await result.json();
const { status } = resultObject;
if (status === 'ZERO_RESULTS') {
if (resultObject.status === 'ZERO_RESULTS') {
return [];
}
else if (status !== 'OK') {
throw new Error(`An error occurred during geocoding. ${status}`);
}
assertGeocodeResults(resultObject);
return resultObject.results.map(result => {

@@ -217,5 +213,6 @@ let location = result.geometry.location;

const resultObject = await result.json();
if (resultObject.status !== 'OK') {
throw new Error('An error occurred during geocoding.');
if (resultObject.status === 'ZERO_RESULTS') {
return [];
}
assertGeocodeResults(resultObject);
return resultObject.results.map(result => {

@@ -246,2 +243,15 @@ const address = {};

}
// https://developers.google.com/maps/documentation/geocoding/intro
function assertGeocodeResults(resultObject) {
const { status, error_message } = resultObject;
if (status !== 'ZERO_RESULTS' && status !== 'OK') {
if (error_message) {
throw new CodedError(status, error_message);
}
else if (status === 'UNKNOWN_ERROR') {
throw new CodedError(status, 'the request could not be processed due to a server error. The request may succeed if you try again.');
}
throw new CodedError(status, `An error occurred during geocoding.`);
}
}
// Polyfill: navigator.geolocation.watchPosition

@@ -248,0 +258,0 @@ function watchPosition(success, error, options) {

{
"name": "expo-location",
"version": "6.0.0",
"version": "7.0.0-rc.0",
"description": "Allows reading geolocation information from the device. Your app can poll for the current location or subscribe to location update events.",

@@ -29,3 +29,4 @@ "main": "build/Location.js",

"type": "git",
"url": "https://github.com/expo/expo.git"
"url": "https://github.com/expo/expo.git",
"directory": "packages/expo-location"
},

@@ -50,5 +51,5 @@ "bugs": {

"devDependencies": {
"expo-module-scripts": "^1.0.0"
"expo-module-scripts": "~1.1.1-rc.0"
},
"gitHead": "9518929d6f2ba9cf8e0aae81d34cc1eb52f7093a"
"gitHead": "5d4fcf318390f59cecd1ae5d191afb15488a4447"
}

@@ -10,6 +10,8 @@ # expo-location

# Installation
# Installation in managed Expo projects
This package is pre-installed in [managed](https://docs.expo.io/versions/latest/introduction/managed-vs-bare/) Expo projects. You may skip the rest of the installation guide if this applies to you.
For managed [managed](https://docs.expo.io/versions/latest/introduction/managed-vs-bare/) Expo projects, please follow the installation instructions in the [API documentation for the latest stable release](#api-documentation). If you follow the link and there is no documentation available then this library is not yet usable within managed projects — it is likely to be included in an upcoming Expo SDK release.
# Installation in bare React Native projects
For bare React Native projects, you must ensure that you have [installed and configured the `react-native-unimodules` package](https://github.com/unimodules/react-native-unimodules) before continuing.

@@ -16,0 +18,0 @@

@@ -1,2 +0,2 @@

import { EventEmitter, Platform } from '@unimodules/core';
import { EventEmitter, Platform, CodedError } from '@unimodules/core';
import invariant from 'invariant';

@@ -77,3 +77,3 @@

};
};
}

@@ -112,6 +112,3 @@ interface Region {

export {
LocationAccuracy as Accuracy,
LocationActivityType as ActivityType,
};
export { LocationAccuracy as Accuracy, LocationActivityType as ActivityType };

@@ -284,3 +281,6 @@ export enum GeofencingEventType {

if (!googleApiKey) {
throw new Error(error.message + ' Please set a Google API Key to use geocoding.');
throw new CodedError(
error.code,
`${error.message} Please set a Google API Key to use geocoding.`
);
}

@@ -307,3 +307,6 @@ return _googleGeocodeAsync(address);

if (!googleApiKey) {
throw new Error(error.message + ' Please set a Google API Key to use geocoding.');
throw new CodedError(
error.code,
`${error.message} Please set a Google API Key to use geocoding.`
);
}

@@ -324,9 +327,8 @@ return _googleReverseGeocodeAsync(location);

const { status } = resultObject;
if (status === 'ZERO_RESULTS') {
if (resultObject.status === 'ZERO_RESULTS') {
return [];
} else if (status !== 'OK') {
throw new Error(`An error occurred during geocoding. ${status}`);
}
assertGeocodeResults(resultObject);
return resultObject.results.map(result => {

@@ -351,6 +353,8 @@ let location = result.geometry.location;

if (resultObject.status !== 'OK') {
throw new Error('An error occurred during geocoding.');
if (resultObject.status === 'ZERO_RESULTS') {
return [];
}
assertGeocodeResults(resultObject);
return resultObject.results.map(result => {

@@ -378,2 +382,18 @@ const address: any = {};

// https://developers.google.com/maps/documentation/geocoding/intro
function assertGeocodeResults(resultObject: any): void {
const { status, error_message } = resultObject;
if (status !== 'ZERO_RESULTS' && status !== 'OK') {
if (error_message) {
throw new CodedError(status, error_message);
} else if (status === 'UNKNOWN_ERROR') {
throw new CodedError(
status,
'the request could not be processed due to a server error. The request may succeed if you try again.'
);
}
throw new CodedError(status, `An error occurred during geocoding.`);
}
}
// Polyfill: navigator.geolocation.watchPosition

@@ -380,0 +400,0 @@ function watchPosition(

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

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