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

@nuov.io/slugger

v1.1.59

Published

The @nuov.io slugger library.

Readme

Slugger

Description

Slugger is a lightweight TypeScript base class that provides common test utilities - random slug generation, assign-once properties, auto-generated created and updated timestamps, and error helpers. It is designed to be extended by child classes for more specialized testing scenarios.

Installation

npm install --save-dev @nuov.io/slugger

Usage

import { Slugger } from "@nuov.io/slugger";

const slugger = new Slugger();

// Generate a random 10-character alphanumeric slug
const slug = slugger.generateSlug(); // e.g. "aB3xK9mQ2z"

// Access the persistent primary slug (stable for the instance lifetime)
const id = slugger.primarySlug; // e.g. "pL7wR4nT1c"

// Generate errors with slug-based messages
const error = slugger.generateError(true); // Error("pL7wR4nT1c")

// Assign-once properties (throw if reassigned to a different value)
slugger.assignedValue = "some-value";
slugger.assignedValue = "other-value"; // throws Error

// Auto-generated created/updated timestamps
console.log(slugger.created); // Date (older)
console.log(slugger.updated); // Date (newer)

// Reset all state between tests
slugger.beforeEach();

Using in a test suite

import { Slugger } from "@nuov.io/slugger";

const slugger = new Slugger();

beforeEach(() => {
  slugger.beforeEach();
});

it("should generate unique slugs for tests", () => {
  const a = slugger.generateSlug();
  const b = slugger.generateSlug();
  expect(a).not.toEqual(b);
  expect(a.length).toEqual(10);
});

API Reference

Properties

| Property | Type | Description | | ---------------- | --------------------- | ---------------------------------------------- | | assignedValues | Array<unknown> | Array for collecting multiple assigned values. | | error | Error \| undefined | A general-purpose error slot. | | sentence | string \| undefined | A sentence string, used by sentenceError. | | value | string \| undefined | A general purpose value slot. |

Getters

| Method | Returns | Description | | ------------------ | -------------------- | --------------------------------------------------------------------------------------------------------------- | | assignedError | Error \| undefined | The assigned error, or undefined if not yet assigned. | | assignedValue | unknown | The assigned value, or undefined if not yet assigned. | | created | Date | Auto-generated creation timestamp (1 min - 1 hr before updated). | | faker | Faker | The Faker instance. | | handledError | Error \| undefined | The handled error, or undefined if not yet assigned. | | handledValue | unknown | The handled value, or undefined if not yet assigned. | | primarySlug | string | The persistent 10-character slug. This is generated on construction and regenerated by the beforeEach() method. | | sentenceError | Error | Creates an Error from the sentence property. Throws if sentence is undefined. | | theQuickBrownFox | string | Returns "The quick brown fox jumped over the lazy dog." | | updated | Date | Auto-generated update timestamp (1 hr - 1 wk in the past). |

Setters (assign-once)

The following setters enforce assign-once semantics - setting a value a second time with a different value throws an Error.

| Setter | Type | Throws on reassignment | | --------------- | -------------------- | ----------------------------------------------------- | | assignedError | Error \| undefined | "The property 'assignedError' is already assigned." | | assignedValue | unknown | "The property 'assignedValue' is already assigned." | | handledError | Error \| undefined | "The property 'handledError' is already assigned." | | handledValue | unknown | "The property 'handledValue' is already assigned." |

Generation Methods

| Method | Returns | Description | | ------------------------------------------- | -------------- | --------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | | generateSlug(isPrimary?: boolean) | string | Generates a random 10-character alphanumeric string. Pass true to return the stable primarySlug. | | generateError(isPrimary?: boolean) | Error | Creates an Error whose message is a generated slug (or the primarySlug when isPrimary is true). | | generateErrorHandler(isPrimary?: boolean) | ErrorHandler | Creates an ErrorHandler that assigns a generated error to handledError on execution. The generated Error message is a generated slug (or the primarySlug when isPrimary is true). |

Other Methods

| Method | Returns | Description | | -------------- | ------- | ----------------------------------------------------------------------------------------- | | beforeEach() | void | Resets all state - slugs, errors, values, dates, and sentence - for clean test isolation. |

License

MIT License

Credits

None of this would have been possible without Faker as a starting point.