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

@maproll/map-url

v0.1.2

Published

The maproll map URL grammar: build and parse api.maproll.io map URLs.

Downloads

666

Readme

@maproll/map-url

The maproll map URL grammar: build an api.maproll.io map URL from parameters, and parse one back.

Every maproll map is a URL. This package is the single definition of how that URL is written and read, shared by the editor (app.maproll.io) and the MCP server (@maproll/mcp) so the two cannot drift.

Pure, dependency-free, isomorphic — browser, Node, and Workers.

import { buildUrl, parseUrl, serializeDataRows } from "@maproll/map-url";

const url = buildUrl({
  scope: "world",
  title: "Coffee consumption per capita",
  data: serializeDataRows([
    { kind: "value", id: "FI", value: 12 },
    { kind: "value", id: "US", value: 4.2 },
  ]),
});
// https://api.maproll.io/map.svg?scope=world&title=...&data=FI%3A12%2CUS%3A4.2

const { params, markers, routes } = parseUrl(url);

What's in it

| Export | Purpose | |---|---| | buildUrl, buildEmbed | Params → URL, or a ready <img> tag | | parseUrl, parseMarkers, parseRoutes, hasMapParams | URL → params | | applyPatch | Merge a partial update (null clears, undefined leaves alone) | | serializeDataRows, parseDataString, replaceColorRows, isHexColor | The four data= pair shapes | | serializeMarkers, serializeRoutes | Layer serialisation | | SCOPES, GROUP_SCOPES, ALL_SCOPES, SCOPE_CODES | Scope catalog | | MapParams, MarkerEntry, RouteEntry, DataRow, … | Types |

Design notes

Parsing is forgiving, but never silently wrong. A malformed marker or route is skipped so a hand-edited link still yields the map it mostly describes — but input that would parse into a plausible wrong value is rejected instead. Number("") is 0, so markers=10, would have put a marker on the equator; a route colour written without its # (008000) would have become a stroke width of 8000.

parseUrl only accepts known keys. buildUrl serialises whatever it is handed, so carrying unknown keys through would push a utm_source from a shared link into the render URL. A param added to the API is ignored here until MAP_PARAM_KEYS learns about it — add it in the same change.

Round-tripping preserves the map, not the string. parseUrl fills in defaults, so a minimal URL comes back with them spelled out. Key order is not stable; compare params, not URLs.

Scripts

npm run build      # tsc → dist/
npm test           # vitest
npm run typecheck

src/scopes.ts is generated from the editor's scope list; regenerate it when scopes change.