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

wetherspoons-api

v1.0.0

Published

A simple package to get data from the JD Wetherspoons API

Downloads

22

Readme

Wetherspoons API

A TypeScript package for accessing JD Wetherspoon's venue and menu data, including drink information with pricing and alcohol unit calculations.

npm version License: MIT Tests

Installation

npm install wetherspoons-api

Features

  • 🏪 Fetch all Wetherspoons venues
  • 📍 Get detailed venue information
  • 🍺 Access venue menus and drinks
  • 💰 Calculate price per unit (PPU) for alcoholic beverages
  • ✅ Type-safe with TypeScript and Zod validation
  • 🔄 Automatic handling of different portion sizes

Usage

Get All Venues

import { venues } from 'wetherspoons-api';

const allVenues = await venues();
console.log(allVenues);
// [
//   {
//     franchise: 'lloyds',
//     id: 123,
//     isClosed: false,
//     name: 'The Moon Under Water',
//     venueRef: 456
//   },
//   ...
// ]

Get Venue Details

import { venues, getVenue } from 'wetherspoons-api';

const allVenues = await venues();
const venue = allVenues[0];
const details = await getVenue(venue);

console.log(details);
// {
//   canPlaceOrder: true,
//   franchise: 'lloyds',
//   id: 123,
//   name: 'The Moon Under Water',
//   salesAreas: [{ id: 789 }],
//   venueCanOrder: true,
//   venueRef: 456
// }

Get Drinks with Price Analysis

import { venues, getDrinks } from 'wetherspoons-api';

const allVenues = await venues();
const venue = allVenues[0];
const drinks = await getDrinks(venue);

console.log(drinks);
// [
//   {
//     name: 'Ruddles Best',
//     units: 2.27,
//     productId: 12345,
//     price: 249,  // in pence
//     ppu: 109.69  // price per unit in pence
//   },
//   ...
// ]
// Sorted by best value (lowest price per unit first)

Get Menus

import { venues, getVenue, getMenus, getMenu } from 'wetherspoons-api';

const allVenues = await venues();
const venue = allVenues[0];
const details = await getVenue(venue);

// Get all menus for a sales area
const menus = await getMenus({
  venue: details,
  salesAreaId: details.salesAreas[0].id
});

// Get detailed menu information
const drinksMenu = menus.find(m => m.name === 'Drinks');
if (drinksMenu) {
  const detailedMenu = await getMenu(drinksMenu);
  console.log(detailedMenu.data.categories);
}

API Reference

Functions

venues(): Promise<HighLevelVenue[]>

Fetches all Wetherspoons venues.

Returns: Array of venue objects with basic information.

getVenue(venue: HighLevelVenue): Promise<DetailedVenue>

Gets detailed information about a specific venue.

Parameters:

Returns: Detailed venue information including sales areas and ordering capabilities.

getMenus({ venue, salesAreaId }): Promise<HighLevelMenu[]>

Fetches all menus for a specific sales area in a venue.

Parameters:

  • venue: A detailed venue object from getVenue()
  • salesAreaId: The ID of the sales area

Returns: Array of menu objects.

getMenu(highLevelMenu: HighLevelMenu): Promise<DetailedMenu>

Gets detailed menu information including all products and categories.

Parameters:

Returns: Detailed menu with categories, item groups, and products.

getDrinks(highLevelVenue: HighLevelVenue): Promise<Drink[]>

Fetches all drinks from a venue's drinks menu, calculates alcohol units and price per unit, then sorts by best value.

Parameters:

  • highLevelVenue: A venue object from venues()

Returns: Array of drinks sorted by price per unit (best value first).

Types

HighLevelVenue

{
  franchise: string;
  id: number;
  isClosed: boolean;
  name: string;
  venueRef: number;
}

DetailedVenue

{
  canPlaceOrder: boolean;
  franchise: string;
  id: number;
  isClosed?: boolean;
  name: string;
  salesAreas: Array<{ id: number }>;
  venueCanOrder: boolean;
  venueRef: string | number;
}

Drink

{
  name: string;
  units: number;        // Alcohol units
  productId: number;
  price: number;        // Price in pence
  ppu: number;          // Price per unit in pence
}

How It Works

The package:

  1. Connects to the JD Wetherspoon API
  2. Validates all responses using Zod schemas for type safety
  3. Calculates alcohol units based on ABV and volume information
  4. Determines the best value portion size for each drink
  5. Sorts drinks by price per unit to help find the best deals

Development

# Install dependencies
npm install

# Build the package
npm run build

# Run tests
npm test

# Run tests in watch mode
npm run test:watch

# Run tests with UI
npm run test:ui

# Run tests with coverage
npm run test:coverage

# Lint code
npm run lint

# Fix linting issues
npm run lint:fix

License

MIT © Joss Bird

Contributing

Contributions are welcome! Please feel free to submit a Pull Request.

Issues

Report bugs and feature requests at https://github.com/slack2450/wetherspoons-api/issues