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

@brinzl/observer

v0.1.0

Published

A lightweight, zero-dependency reactive object observation library.

Readme

observer.js

A tiny, zero-dependency reactive object observation library using ES6 Proxies. Observe changes to JavaScript objects and arrays with automatic nested tracking and microtask batching.

Why?

While exploring how Vue.js handle reactivity, and I came across observer pattern that powers their reactive systems. This library was built as a project to understand the fundamentals of reactive programming from first principles.

Inspired by libraries like object-observer, icaro, and micro-observer.

Features

  • Observe deeply nested objects and arrays
  • Automatic change batching via microtasks
  • Path tracking for precise change locations
  • Clean teardown with proxy revocation
  • Zero dependencies, ~2KB minified

Usage

npm install @brinzl/observer

Basic

import { Observer } from '@brinzl/observer';

// Create an observable object.
const obs = Observer.create({ name: 'Alice', age: 30 });

// Subscribe to changes.
const unsubscribe = Observer.observe(obs, (changes) => {
  changes.forEach(change => {
    console.log(change.type);      // 'set' | 'delete'
    console.log(change.path);      // ['name']
    console.log(change.oldValue);  // 'Alice'
    console.log(change.newValue);  // 'Bob'
  });
});

// Mutations trigger the callback.
obs.name = 'Bob';
obs.age = 31;

// Unsubscribe when done.
unsubscribe();

Nested Objects

const obs = Observer.create({
  user: {
    profile: { name: 'Alice' }
  }
});

Observer.observe(obs, (changes) => {
  console.log(changes);
});

// Nested objects are automatically observed.
obs.user.profile.name = 'Bob';
// Change: { type: 'set', path: ['user', 'profile', 'name'], oldValue: 'Alice', newValue: 'Bob' }

Arrays

const obs = Observer.create({ items: [1, 2, 3] });

Observer.observe(obs, (changes) => {
  console.log(changes);
});

obs.items.push(4);
obs.items[0] = 10;

Cleanup

const obs = Observer.create({ data: 'test' });

// Completely destroy the observable.
Observer.destroy(obs);

// Further access throws an error.
obs.data; // TypeError: Cannot perform 'get' on a proxy that has been revoked

Accessing Internals

const { IS_OBSERVABLE, RAW, ROOT, PATH } = Observer.symbols;

const obs = Observer.create({ nested: { value: 1 } });

obs[IS_OBSERVABLE];           // true
obs[RAW];                     // { nested: { value: 1 } } (original object)
obs.nested[PATH];             // ['nested']
obs.nested[ROOT] === obs;     // true

API

| Method | Description | |--------|-------------| | Observer.create(target) | Creates an observable from a plain object or array | | Observer.observe(observable, callback) | Subscribes to changes, returns an unsubscribe function | | Observer.destroy(observable) | Revokes the proxy and clears all subscribers | | Observer.symbols | Internal symbols for accessing raw target, path, and root |

Change Record

{
  type: 'set' | 'delete',
  path: string[],      // e.g. ['user', 'profile', 'name']
  oldValue: any,
  newValue: any
}

License

MIT