npm package discovery and stats viewer.

Discover Tips

  • General search

    [free text search, go nuts!]

  • Package details

    pkg:[package-name]

  • User packages

    @[username]

Sponsor

Optimize Toolset

I’ve always been into building performant and accessible sites, but lately I’ve been taking it extremely seriously. So much so that I’ve been building a tool to help me optimize and monitor the sites that I build to make sure that I’m making an attempt to offer the best experience to those who visit them. If you’re into performant, accessible and SEO friendly sites, you might like it too! You can check it out at Optimize Toolset.

About

Hi, 👋, I’m Ryan Hefner  and I built this site for me, and you! The goal of this site was to provide an easy way for me to check the stats on my npm packages, both for prioritizing issues and updates, and to give me a little kick in the pants to keep up on stuff.

As I was building it, I realized that I was actually using the tool to build the tool, and figured I might as well put this out there and hopefully others will find it to be a fast and useful way to search and browse npm packages as I have.

If you’re interested in other things I’m working on, follow me on Twitter or check out the open source projects I’ve been publishing on GitHub.

I am also working on a Twitter bot for this site to tweet the most popular, newest, random packages from npm. Please follow that account now and it will start sending out packages soon–ish.

Open Software & Tools

This site wouldn’t be possible without the immense generosity and tireless efforts from the people who make contributions to the world and share their work via open source initiatives. Thank you 🙏

© 2025 – Pkg Stats / Ryan Hefner

x5-geometry

v1.0.1

Published

Geometry and word processing utilities for XNet

Downloads

14

Readme

Computational Geometry for XNET

Created by Sint Connexa, aka Rich DeVaul @xnet-mobile and @rdevaul

This folder is the home for the core X5 Hex Grid libraries and some related tools and code conversions. X5 provides the basis for the XNET hex grid system, and differs in important ways in design and implementation from Uber's H3 system. See the X5 Hex Grid documentation for more information.

This folder is also the home to computation geometry tools that are used for the batch processing of geo data in order to build the maps and dictionaries used by the XNET visualizer, and ultimately the on-chain smart-contract implementations.

Contents

Here are some of the more interesting contents of this repo:

  • src/geom.ts — the reference implementation for core X5 hex mapping

  • src/words2index.ts — map X5 hex indices into three-word names, and vice versa.

  • python/zip2map.py — a yapCAD-based tool for generating hex tilings of zipcodes

  • LICENSE — MIT license, which applies to all contents unless otherwise stated

  • docs — documentation home

  • assets — images and reference data

  • src — TypeScript source code

  • python — Python source code

  • output — a working directory for the zip2map.py script

Contact

For questions about this repo, please jump into the XNET discord server at https://discord.gg/qJFJwkBZwj or email [email protected]

NPM Package Usage

This repository is also available as an npm package for use in TypeScript/JavaScript projects. See src/README.md for detailed usage instructions.

Features

  • Hexagonal grid geometry calculations
  • Word-to-index and index-to-word conversions
  • Adjective and noun word lists
  • GPS coordinate handling
  • TypeScript support with full type definitions

Installation

npm install xnet-geometry

Usage

import {
    // Geometry functions
    haversine,
    travel,
    grid2latLon,
    latLon2grid,
    
    // Word processing
    getAdjectiveIndex,
    getNounIndex,
    ij2string,
    string2ij
} from 'xnet-geometry';

// Calculate distance between two points
const distance = haversine(lat1, lon1, lat2, lon2);

// Convert grid coordinates to lat/lon
const [lat, lon] = grid2latLon(i, j);

// Convert lat/lon to grid coordinates
const [i, j] = latLon2grid(lat, lon);

// Convert grid coordinates to word string
const wordString = ij2string(i, j);

// Convert word string back to grid coordinates
const [i, j] = string2ij(wordString);

// Get word indices
const adjIndex = getAdjectiveIndex('beautiful');
const nounIndex = getNounIndex('dinosaur');

API

Geometry Functions

  • haversine(lat1: number, lon1: number, lat2: number, lon2: number): number
    • Calculate the great-circle distance between two points
  • travel(lat1: number, lon1: number, Δx: number, Δy: number): [number, number]
    • Calculate new lat/lon coordinates after traveling a distance
  • grid2latLon(i: number, j: number, maxLat?: number, step?: number, offset?: number): [number, number]
    • Convert grid coordinates to lat/lon
  • latLon2grid(lat: number, lon: number, maxLat?: number, step?: number, offset?: number): [number, number]
    • Convert lat/lon to grid coordinates

Word Processing Functions

  • getAdjectiveIndex(word: string): number
    • Get the index of an adjective in the word list
  • getNounIndex(word: string): number
    • Get the index of a noun in the word list
  • ij2string(i: number, j: number): string
    • Convert grid coordinates to a three-word string
  • string2ij(string: string): [number, number]
    • Convert a three-word string back to grid coordinates

License

MIT License - see LICENSE file for details.

Contact

For questions about this repo, please jump into the XNET discord server at https://discord.gg/qJFJwkBZwj or email [email protected]