git clone https://github.com/forgesworn/geohash-kit.git
cd geohash-kit
npm install| Command | Purpose |
|---|---|
npm test |
Run all tests (vitest) |
npm run test:watch |
Watch mode |
npm run build |
Compile TypeScript to dist/ |
npm run typecheck |
Type-check without emitting |
npm run bench |
Run performance benchmarks |
src/
core.ts — encode, decode, bounds, neighbours, distance
coverage.ts — polygon coverage, GeoJSON, convex hull, deduplication
nostr.ts — Nostr g-tag ladders, REQ filters, ring expansion
index.ts — barrel re-export
Three subpath exports mirror the source modules: geohash-kit/core, geohash-kit/coverage, geohash-kit/nostr.
- British English — neighbour, colour, metre, licence
- Zero dependencies — no runtime deps. Only vitest and typescript as dev deps.
- ESM-only —
"type": "module"in package.json - TDD — write a failing test first, then implement
- Input validation — all public APIs validate inputs and throw
RangeErroron invalid parameters
Tests live alongside source files as *.test.ts. The suite includes unit tests, fuzz tests, and property-based tests (736 total).
# Run all tests
npm test
# Run a specific test file
npx vitest run src/core.test.ts
# Watch mode
npm run test:watch- Fork the repository
- Create a feature branch:
git checkout -b feat/my-change - Write tests for your changes
- Ensure all tests pass:
npm test - Ensure types check:
npm run typecheck - Commit with a conventional message (see below)
- Open a pull request against
main
This project uses semantic-release — commit message prefixes determine version bumps:
| Prefix | Version bump | Example |
|---|---|---|
feat: |
Minor (1.x.0) | feat: add bounding box intersection |
fix: |
Patch (1.0.x) | fix: handle antimeridian wrap |
docs: |
None | docs: update API reference |
chore: |
None | chore: update dev dependencies |
refactor: |
None | refactor: simplify polygon walk |