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

@pippenly/ts-utils

v1.2.0

Published

Library where I implement ideas I have or consolidate utilities/helpers I use often

Readme

TS-Utils

Library where I implement ideas I have or consolidate utilities/helpers I use often

DOM

Resin

A reactive state that can bind to an HTML element to automatically apply updates based on value changes. Has some utilities for controlling visibility, mapping inner values, and passes the default element event listener through so you can use those normally.

const number = resin(5); // Resin<T>;
const numberElment = document.getElementById("number")!; // HTMLElement
const otherNumberElement = document.getElementById("other-number")!; // HTMLElement
const binding = bind(number, numberElment); // BoundResin<T>
const complexBinding = bind(number, otherNumberElement, {
    bindTo: "innerText",
    map: (n) => n * 2,
    tap: (n, el) => { ... },
    if: (n) => n > 5,
    class: {
        "red": (n, el) => n > 10,
        "blue": (n, el) => n <= 10
    },
    attr: {
        "data-value": (n, el) => String(n)
    }
});

number.value = 15; // Updates number.value, which triggers the effect to update innerText

setTimeout(() => {
    console.log("Stop receiving updates for counter binding");
    binding.dispose();
}, 5000);

Two-way binding

For two way binding, model(sourceResin, element, options?) exists, where element is type ModelElement = HTMLInputElement | HTMLTextAreaElement | HTMLSelectElement. Provides throttle / debounce options and custom get/set if needed.

import { resin, bind, model, watchEffect } from "@pippenly/ts-utils/dom";

const name = resin("");
const m = model(name, document.querySelector<HTMLInputElement>("#name")!, {
    debounce: 300
});

const checked = resin(false);
const checkedModel = model(checked, document.querySelector<HTMLInputElement>("#check")!, {
    event: 'change',
    get: (el) => el.checked,
    set: (v, el) => { el.checked = v; }
});

const age = resin(0);
const ageModel = model(age, document.querySelector<HTMLInputElement>("#age")!, {
    get: (el) => el.valueAsNumber,
    set: (v, el) => { el.valueAsNumber = v; }
});

Scope

Idea for an IoC container, will keep refining as usages reveal cracks. For now, have a naive usage example:


interface HttpClient {
    get(url: string): Promise<string>;
}

interface DbConnection<T> {
    query(sql: string): Promise<T>;
}

async function main() {
    const HttpClient = defineToken<HttpClient>({
        name: "HttpClient",
        lifetime: "scoped",
        instantiation: "lazy",
        build: async () =>
            Ok(ENV === "production" ? new ProdHttpClient() : new DevHttpClient()),
    });

    const DbConnection = defineToken<DbConnection<string>>({
        name: "DbConnection",
        lifetime: "singleton",
        instantiation: "eager",
        build: async () =>
            Ok(ENV === "production" ? new ProdDbConnection() : new DevDbConnection()),
        teardown: async (instance) => { ... },
    });

    const container = root(HttpClient, DbConnection);

    const task = defineTask<typeof container>()({
        deps: [HttpClient, DbConnection] as const,
        run: async ([httpClient, dbConnection], { url, sql }: TaskArgs) => {
            const httpResponse = await httpClient.get(url);
            const dbResult = await dbConnection.query(sql);
            return Ok<QueryResult>({ data: `${httpResponse} | ${dbResult}` });
        },
    });

    const scopeResult = await container.scope();
    if (!scopeResult.ok) {
        console.error("Failed to create scope:", scopeResult.error);
        return;
    }

    const result = await scopeResult.value.run(task, {
        url: "http://example.com",
        sql: "SELECT * FROM users",
    });

    if (!result.ok) {
        console.error("Task failed:", result.error);
    } else {
        console.log("Task succeeded:", result.value);
    }
}

Utilities

Result

Small utility library so I can work with error as values and explict Error type declaration

Structures

Queue only so far, it's what I found myself using the most often

Utils

Quality of life things