@theholocron/location-utils 1.0.0 → 1.0.2

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (2) hide show
  1. package/README.md +32 -4
  2. package/package.json +1 -1
package/README.md CHANGED
@@ -1,11 +1,39 @@
1
- # Location
1
+ # `@theholocron/location-utils`
2
2
 
3
- Location utilities.
3
+ Browser geolocation utilities.
4
4
 
5
5
  ## Installation
6
6
 
7
7
  ```bash
8
- npm install --save-dev @theholocron/utils-location
8
+ pnpm add @theholocron/location-utils
9
9
  ```
10
10
 
11
- Check out [The Holocron Archive](https://docs.theholocron.dev/projects/utilities/) for more information.
11
+ ## Usage
12
+
13
+ ```typescript
14
+ import { location } from "@theholocron/location-utils";
15
+
16
+ const coords = await location.getCurrent();
17
+ // {
18
+ // latitude: 37.7749,
19
+ // longitude: -122.4194,
20
+ // accuracy: 10,
21
+ // altitude: null,
22
+ // altitudeAccuracy: null,
23
+ // heading: null,
24
+ // speed: null,
25
+ // }
26
+ ```
27
+
28
+ ### `location.getCurrent()`
29
+
30
+ Requests the device's current position via the [Geolocation API](https://developer.mozilla.org/en-US/docs/Web/API/Geolocation_API). Returns a `Promise<IGeolocationCoordinates>`.
31
+
32
+ - If geolocation permission is denied, returns fallback coordinates `{ latitude: 0, longitude: 0, accuracy: 0 }` with a console warning.
33
+ - Uses `enableHighAccuracy: true` and a 27-second timeout.
34
+
35
+ > **Note:** Requires a browser environment — does not work in Node.js.
36
+
37
+ ## Documentation
38
+
39
+ Check out [The Holocron Archive](https://docs.theholocron.dev/projects/utils/) for more information.
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@theholocron/location-utils",
3
- "version": "1.0.0",
3
+ "version": "1.0.2",
4
4
  "description": "Location utilities.",
5
5
  "homepage": "https://github.com/theholocron/utils/tree/main/packages/utils-location#readme",
6
6
  "bugs": "https://github.com/theholocron/utils/issues",