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

@ganbarodigital/ts-lib-http-types

v0.3.1

Published

Basic types to describe the HTTP protocol

Readme

Basic Types for the HTTP Protocol

Node.js CI

Introduction

This TypeScript library provides some basic types to describe the HTTP protocol. Use it to improve the type-safety of your code.

Quick Start

# run this from your Terminal
npm install @ganbarodigital/ts-lib-http-types
// add this import to your Typescript code
import { HttpStatusCode } from "@ganbarodigital/ts-lib-http-types/lib/v1"

VS Code users: once you've added a single import anywhere in your project, you'll then be able to auto-import anything else that this library exports.

V1 API

HttpStatusCode

/**
 * represents any HTTP status code in the range `100` to `599` inclusive
 */
export type HttpStatusCode = Branded<number, "@ganbarodigital/HttpStatusCode">;

HttpStatusCode is a type. At runtime, it resolves down to a native Javascript number.

httpStatusCodeFrom()

export function httpStatusCodeFrom(input: number, onError?: OnError): HttpStatusCode;

httpStatusCodeFrom() is a smart constructor. It converts input numbers into HttpStatusCode types at compile time.

isHttpStatusCode()

/**
 * data guard. checks to see if the `input` value is in the range
 * of HTTP status codes.
 *
 * returns `true` if `input` is a number between 100 and 599 inclusive.
 */
export function isHttpStatusCode(input: number): boolean;

isHttpStatusCode() is a data guard. Use it to check that a given number is a valid HTTP status code.

mustBeHttpStatusCode()

/**
 * data guarantee. calls the supplied `onError()` handler if the `input`
 * number is not a valid HTTP status code.
 */
export function mustBeHttpStatusCode(input: number, onError: OnError): void

mustBeHttpStatusCode() is a data guarantee. Use it to make sure that a given number is a valid HTTP status code.

Internal Note

This package simply republishes internal types from @ganbarodigital/ts-lib-error-reporting.

The types used to live in here. Unfortunately, we ran into a lot of trouble with circular dependencies (which broke unit testing).

NPM Scripts

npm run clean

Use npm run clean to delete all of the compiled code.

npm run build

Use npm run build to compile the Typescript into plain Javascript. The compiled code is placed into the lib/ folder.

npm run build does not compile the unit test code.

npm run test

Use npm run test to compile and run the unit tests. The compiled code is placed into the lib/ folder.

npm run cover

Use npm run cover to compile the unit tests, run them, and see code coverage metrics.

Metrics are written to the terminal, and are also published as HTML into the coverage/ folder.