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

@elgato/utils

v0.4.1

Published

Utilities used throughout the Elgato ecosystem.

Downloads

1,964

Readme

@elgato/utils

Utilities used throughout the Elgato ecosystem.

@elgato/utils npm package Elgato homepage

Installation

npm install @elgato/utils

Disposables

deferredDisposable

Creates a new function that implements Symbol.dispose and accepts a disposer function. The disposer function is called when the new function is disposed.

import { deferredDisposable } from "@elgato/utils";

{
    using deferredDisposable(() => console.log("Hello world"));
    // ...
}

// "Hello world"

DisposableStack

Stack of managed resources, controlled by a single disposer. Partial polyfill of TC39 Explicit Resource Management's DisposableStack.

import { DisposableStack } from "@elgato/utils";

{
    using stack = new DisposableStack();
    stack.defer(() => "Hello");
    stack.defer(() => "world");
    // ...
}

// "Hello"
// "world"

Events

EventEmitter

An strongly-typed event emitter that enables the listening for, and emitting of, events; supported in browser and Node.js environments.

import { EventEmitter } from "@elgato/utils";

type EventMap = {
    created: [name: string];
};

const emitter = new EventEmitter<EventMap>();
emitter.on("created", (name: string) => {
    // ...
});

JSON

JsonObject

Type that represents an object within JSON.

import { type JsonObject } from "@elgato/utils";

const obj: JsonObject = {
    name: "Elgato",
};

JsonPrimitive

Type that represents a primitive within JSON, for example a string or number.

import { type JsonPrimitive } from "@elgato/utils";

const value: JsonPrimitive = "Elgato";

JsonValue

Type that represents a valid JSON value, for example an object, array, or primitive.

import { type JsonValue } from "@elgato/utils";

const value: JsonValue = ["Hello", "World"];

Miscellaneous

Enumerable

Provides a read-only iterable collection of items that also acts as a partial polyfill for iterator helpers.

import { Enumerable } from "@elgato/utils";

const items = new Enumerable(["One", "Two", "Three", "Four"]);
items
    .drop(1) // Drop "One"
    .take(2); // Take "Two" & "Three"

Polyfilled iterator helpers:

  • Symbol.iterator
  • asIndexedPairs()
  • drop(limit)
  • every(predicate)
  • filter(predicate)
  • find(predicate)
  • findLast(predicate)
  • flapMap(mapper)
  • forEach(fn)
  • includes(search)
  • map(mapper)
  • reduce(accumulator, initial)
  • some(predicate)
  • take(limit)
  • toArray()

Lazy

Object that wraps a lazily instantiated value, similar to C# Lazy<T>.

import { Lazy } from "@elgato/utils";

const lazy = new Lazy(() => "Hello world");
lazy.value; // "Hello world";

Objects

get(source, path)

Gets the value at the specified (deep) path.

import { get } from "@elgato/utils";

const obj = {
    name: "Elgato",
};

get(obj, "name"); // Elgato

set(target, path, value)

Sets the value at the specified (deep) path.

import { get } from "@elgato/utils";

const obj = {
    name: "Gato",
};

set(obj, "name", "Elgato"); // { name: "Elgato" }

Parsers

parseBoolean(value)

Parses the value a truthy-boolean; the strings "0" and "false" are parsed as false.

import { parseBoolean } from "@elgato/utils";

const a = parseBoolean(1); // true
const b = parseBoolean("false"); // false

parseNumber(value)

Attempts to parse a value to a number; returns undefined when parsing was unsuccessful.

import { parseNumber } from "@elgato/utils";

const number = parseNumber("13"); // 13

Promises

withResolvers()

Function that returns an object that contains the promise, and two functions to resolve or reject it. Polyfill of Promise.withResolvers().

import { withResolvers } "@elgato/utils";

const { promise, resolve, reject } = withResolvers<string>();

Strings

format(format, ...args)

Formats the specified string, replacing placeholders with their associated arguments.

import { format } from "@elgato/utils";

format("Hello {0}, from {1}", "world", "Elgato"); // Hello world, from Elgato

Timers

debounce(fn, delay)

Wraps a function; subsequent invocations of the wrapped function made within the specified delay are debounced to prevent multiple calls.

import { debounce } from "@elgato/utils";

const fn = debounce(() => console.log("Hello world"), 1000);

fn(); // Debounced
fn(); // "Hello world"