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 🙏

© 2026 – Pkg Stats / Ryan Hefner

@gittrends-app/geocoder

v5.0.5

Published

--- This `README.md` file provides an overview of the project and usage example. ---

Readme


This README.md file provides an overview of the project and usage example.

GitTrends Geocoder - core

GitTrends Geocoder is a geocoding service that uses OpenStreetMap and other services to provide geocoding functionality. It includes caching and request control mechanisms to improve its performance.

Usage

Here is an example of how to use the GitTrends Geocoder with OpenStreetMap and caching:

import { tmpdir } from 'node:os';
import { resolve } from 'node:path';
import prettyformat from 'pretty-format';
import { Cache, OpenStreetMap } from '../src/index.js';

(async function main() {
  // Create a new instance of the OpenStreetMap service
  const openstreetmap = new OpenStreetMap({
    concurrency: 1,
    minConfidence: 0.5
  });

  // Create a cache decorator for the OpenStreetMap service (optional)
  // This decorator works as a proxy for the OpenStreetMap service caching previous results
  const service = new Cache(openstreetmap, {
    dirname: resolve(tmpdir(), 'addresses.json'),
    size: 1000,
    ttl: 0
  });

  // Some examples of addresses for testing

  let response = await service.search('Europe');
  console.log(prettyformat.format(response, { min: true }));
  // output: {"confidence": 0.8778887201599463, "name": "Europe", "source": "Europe", "type": "continent"}

  response = await service.search('Earth planet');
  console.log(prettyformat.format(response, { min: true }));
  // output: null

  response = await service.search('Brazil');
  console.log(prettyformat.format(response, { min: true }));
  // output: {"confidence": 0.8954966110329021, "country": "Brazil", "country_code": "BR", "name": "Brazil", "source": "Brazil", "type": "country"}

  response = await service.search('São Paulo, BR');
  console.log(prettyformat.format(response, { min: true }));
  // output: {"confidence": 0.7446516338789693, "country": "Brazil", "country_code": "BR", "name": "Brazil, São Paulo", "source": "São Paulo, BR", "state": "São Paulo", "type": "municipality"}
})();

API

OpenStreetMap

The OpenStreetMap class provides geocoding functionality using the OpenStreetMap service.

OpenStreetMap(options: { concurrency: number; minConfidence: number })
  • options.concurrency: The number of concurrent requests allowed.
  • options.minConfidence: The minimum confidence level required for a result.

Cache

The Cache class provides a caching mechanism for the geocoding service.

Cache(service: OpenStreetMap, options: { dirname: string; size: number; ttl: number })
  • service: The geocoding service to be cached.
  • options.dirname: The directory name where the cache will be stored.
  • options.size: The maximum size of the cache.
  • options.ttl: The time-to-live for cache entries (in seconds).