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

@williamthorsen/toolbelt.objects

v4.3.1

Published

Utilities for working with objects in JavaScript and TypeScript

Downloads

623

Readme

@williamthorsen/toolbelt.objects

Functions for working with objects.

Installation

Requires Node.js 24 or later.

Adoption checks

The package ships a ReadyUp kit, so a project that installs it can ask how far its adoption got:

rdy run --packages

The kit reads the project's tracked sources and reports three hand-rolled idioms in them, each counted against the calls that the project already makes into this package. Two report at recommend: They are correct code that a published utility expresses better. The third reports at warn, because it is a defect.

A hasOwnProperty call reached through Object.prototype is claimed. Object.hasOwn is the platform form and is enough wherever the result narrows nothing; hasOwnProperty from /candidate earns its place by returning a type predicate that narrows the target, which Object.hasOwn does not. The unguarded call on the value itself is not claimed: It is a defect rather than a verbose spelling, and eslint's recommended no-prototype-builtins already reports it.

A record guard is claimed where a conjunction pairs a test against the object tag with a test against null, in either order, and ends there or at a matching !Array.isArray. isRecord replaces the longer form and isRecordOrArray the shorter, and both return a type predicate, so the narrowing performed by the conjunction is preserved. A conjunction with a further operand, such as typeof err === 'object' && err !== null && 'code' in err, is not claimed: Adoption there is a rewrite rather than a substitution. isPlainObject answers the stricter question of whether a value has Object.prototype and nothing exotic, and no expression claimed by the kit asks it.

An equality test between two JSON.stringify calls is claimed at warn, and its !== mirror with it. Comparing serializations answers the wrong question twice: The result is key-order dependent, so two objects with the same entries in a different order compare unequal, and a Set serializes as an empty object whatever it holds, so any two Sets compare equal. isEqual from /candidate sorts keys and converts Sets to arrays before comparing. A call that the source compares against anything else is serializing rather than comparing, and is not claimed.

Bootstrap wrappers under bin/ are exempt: Such a wrapper imports only builtins so its build-first message survives an incomplete install, and importing this package there would replace that message with a module-resolution failure. Tests are exempt too, since they write these forms deliberately. A source declared generated or vendored by the project in its own .gitattributes, under linguist-generated or linguist-vendored, is exempt as well: The sweep drops it before the kit sees it, so committed bundler output yields no advice that anyone could act on. The sweep is readyup's, so this holds on readyup 0.35.0 or later.

A reviewed site is silenced by an rdy-ignore pragma on its own line, or rdy-ignore-next-line on the line above. A pragma naming a check's id suppresses that check alone; with no id it covers every check on the line. A failed check prints its id ahead of its fraction, which is the form to write:

// rdy-ignore-next-line toolbelt.objects/no-hand-rolled-record-guard -- the value is validated upstream
const ok = typeof value === 'object' && value !== null;

Add the package to .config/readyup.config.ts to include it in a routine sweep:

export default defineRdyConfig({
  packages: ['@williamthorsen/toolbelt.objects'],
});