style: apply prettier formatting to wiki files and wiki-sync workflow

This commit is contained in:
Aric Camarata 2026-03-08 16:51:28 -04:00
parent f6f22f87e1
commit 200f661944
3 changed files with 53 additions and 41 deletions

View file

@ -3,7 +3,7 @@ name: Sync Wiki
on:
push:
branches: [main]
paths: ['.wiki/**']
paths: [".wiki/**"]
permissions:
contents: write

View file

@ -16,9 +16,9 @@ where φ₁, λ₁ is the observer and φ₂, λ₂ is the Ka'bah.
**Parameters:**
| Name | Type | Description |
| ----- | -------- | ------------------------------------------ |
| `lat` | `number` | Observer latitude in decimal degrees. Valid range: 90 to 90. |
| Name | Type | Description |
| ----- | -------- | ---------------------------------------------------------------- |
| `lat` | `number` | Observer latitude in decimal degrees. Valid range: 90 to 90. |
| `lng` | `number` | Observer longitude in decimal degrees. Valid range: 180 to 180. |
**Returns:** `number` — Bearing in degrees clockwise from true north. Range: [0, 360).
@ -26,11 +26,11 @@ where φ₁, λ₁ is the observer and φ₂, λ₂ is the Ka'bah.
**Throws:** `RangeError` if either coordinate is out of bounds.
```typescript
import { qiblaAngle } from '@acamarata/qibla';
import { qiblaAngle } from "@acamarata/qibla";
qiblaAngle(40.7128, -74.006); // ~58.48 (New York → Mecca)
qiblaAngle(51.5074, -0.1278); // ~119.0 (London → Mecca)
qiblaAngle(35.6762, 139.6503); // ~293.3 (Tokyo → Mecca)
qiblaAngle(40.7128, -74.006); // ~58.48 (New York → Mecca)
qiblaAngle(51.5074, -0.1278); // ~119.0 (London → Mecca)
qiblaAngle(35.6762, 139.6503); // ~293.3 (Tokyo → Mecca)
```
---
@ -43,19 +43,19 @@ Maps the bearing to one of eight 45° sectors, selecting the nearest cardinal or
**Parameters:**
| Name | Type | Description |
| --------- | -------- | ---------------------------- |
| `bearing` | `number` | Bearing in degrees (0360). |
| Name | Type | Description |
| --------- | -------- | --------------------------- |
| `bearing` | `number` | Bearing in degrees (0360). |
**Returns:** `CompassAbbr` — One of: `N`, `NE`, `E`, `SE`, `S`, `SW`, `W`, `NW`.
```typescript
import { compassDir } from '@acamarata/qibla';
import { compassDir } from "@acamarata/qibla";
compassDir(0); // "N"
compassDir(45); // "NE"
compassDir(0); // "N"
compassDir(45); // "NE"
compassDir(58.5); // "NE"
compassDir(270); // "W"
compassDir(270); // "W"
```
---
@ -66,14 +66,14 @@ Returns the full compass direction name for a bearing.
**Parameters:**
| Name | Type | Description |
| --------- | -------- | ---------------------------- |
| `bearing` | `number` | Bearing in degrees (0360). |
| Name | Type | Description |
| --------- | -------- | --------------------------- |
| `bearing` | `number` | Bearing in degrees (0360). |
**Returns:** `CompassName` — One of: `North`, `Northeast`, `East`, `Southeast`, `South`, `Southwest`, `West`, `Northwest`.
```typescript
import { compassName } from '@acamarata/qibla';
import { compassName } from "@acamarata/qibla";
compassName(58.5); // "Northeast"
```
@ -88,11 +88,11 @@ Useful for drawing the Qibla direction line on a map. Returns `steps + 1` points
**Parameters:**
| Name | Type | Default | Description |
| ------- | -------- | ------- | ------------------------------------------------ |
| `lat` | `number` | — | Observer latitude in decimal degrees (90 to 90). |
| Name | Type | Default | Description |
| ------- | -------- | ------- | ---------------------------------------------------- |
| `lat` | `number` | — | Observer latitude in decimal degrees (90 to 90). |
| `lng` | `number` | — | Observer longitude in decimal degrees (180 to 180). |
| `steps` | `number` | `120` | Number of segments. Result has `steps + 1` points. |
| `steps` | `number` | `120` | Number of segments. Result has `steps + 1` points. |
**Returns:** `[number, number][]` — Array of `[latitude, longitude]` pairs in degrees.
@ -101,7 +101,7 @@ Useful for drawing the Qibla direction line on a map. Returns `steps + 1` points
Special case: if the observer is at the Ka'bah (distance = 0), returns `[[lat, lng]]`.
```typescript
import { qiblaGreatCircle } from '@acamarata/qibla';
import { qiblaGreatCircle } from "@acamarata/qibla";
const path = qiblaGreatCircle(40.7128, -74.006); // 121 points
// path[0] ≈ [40.7128, -74.006] (New York)
@ -118,17 +118,17 @@ Uses the haversine formula with a spherical Earth (R = 6,371 km, WGS-84 volumetr
**Parameters:**
| Name | Type | Description |
| ------ | -------- | ------------------------------------- |
| `lat1` | `number` | First point latitude in decimal degrees. |
| `lng1` | `number` | First point longitude in decimal degrees. |
| `lat2` | `number` | Second point latitude in decimal degrees. |
| Name | Type | Description |
| ------ | -------- | ------------------------------------------ |
| `lat1` | `number` | First point latitude in decimal degrees. |
| `lng1` | `number` | First point longitude in decimal degrees. |
| `lat2` | `number` | Second point latitude in decimal degrees. |
| `lng2` | `number` | Second point longitude in decimal degrees. |
**Returns:** `number` — Distance in kilometers.
```typescript
import { distanceKm, KAABA_LAT, KAABA_LNG } from '@acamarata/qibla';
import { distanceKm, KAABA_LAT, KAABA_LNG } from "@acamarata/qibla";
distanceKm(40.7128, -74.006, KAABA_LAT, KAABA_LNG); // ~9,634 km
```
@ -137,14 +137,14 @@ distanceKm(40.7128, -74.006, KAABA_LAT, KAABA_LNG); // ~9,634 km
## Constants
| Constant | Value | Description |
| ----------------- | ----------- | --------------------------------------------------- |
| `KAABA_LAT` | `21.422511` | Ka'bah center latitude in decimal degrees north. |
| `KAABA_LNG` | `39.82615` | Ka'bah center longitude in decimal degrees east. |
| `EARTH_RADIUS_KM` | `6371` | WGS-84 volumetric mean radius in kilometers. |
| Constant | Value | Description |
| ----------------- | ----------- | ------------------------------------------------ |
| `KAABA_LAT` | `21.422511` | Ka'bah center latitude in decimal degrees north. |
| `KAABA_LNG` | `39.82615` | Ka'bah center longitude in decimal degrees east. |
| `EARTH_RADIUS_KM` | `6371` | WGS-84 volumetric mean radius in kilometers. |
```typescript
import { KAABA_LAT, KAABA_LNG, EARTH_RADIUS_KM } from '@acamarata/qibla';
import { KAABA_LAT, KAABA_LNG, EARTH_RADIUS_KM } from "@acamarata/qibla";
```
---
@ -154,15 +154,21 @@ import { KAABA_LAT, KAABA_LNG, EARTH_RADIUS_KM } from '@acamarata/qibla';
### `CompassAbbr`
```typescript
type CompassAbbr = 'N' | 'NE' | 'E' | 'SE' | 'S' | 'SW' | 'W' | 'NW';
type CompassAbbr = "N" | "NE" | "E" | "SE" | "S" | "SW" | "W" | "NW";
```
### `CompassName`
```typescript
type CompassName =
| 'North' | 'Northeast' | 'East' | 'Southeast'
| 'South' | 'Southwest' | 'West' | 'Northwest';
| "North"
| "Northeast"
| "East"
| "Southeast"
| "South"
| "Southwest"
| "West"
| "Northwest";
```
---

View file

@ -24,10 +24,16 @@ npm install @acamarata/qibla
```
```typescript
import { qiblaAngle, compassDir, distanceKm, KAABA_LAT, KAABA_LNG } from '@acamarata/qibla';
import {
qiblaAngle,
compassDir,
distanceKm,
KAABA_LAT,
KAABA_LNG,
} from "@acamarata/qibla";
const bearing = qiblaAngle(40.7128, -74.006); // New York
console.log(bearing); // ~58.48
console.log(bearing); // ~58.48
console.log(compassDir(bearing)); // "NE"
const km = distanceKm(40.7128, -74.006, KAABA_LAT, KAABA_LNG);