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

generaljs-reactive-observer

v0.0.1

Published

Observa, intercepta y traza cambios en variables, objetos y estructuras profundas con una sola clase. ReactiveObserver encapsula 4 utilidades reactivas (watchVar, watchObject, watchDeep, watchTree) para sistemas trazables, modulares y extensibles.

Readme

🧠 ReactiveObserver — Observa, intercepta y traza cambios en JS

version reactive modular traceable zero-deps

Observa variables, objetos, estructuras anidadas y árboles completos.
Ejecuta acciones, genera historial, diffs y se integra con sistemas reactivamente trazables.


🔧 API principal

| Método | Descripción | |---------------------|--------------------------------------------------------------| | watchVar() | Observa una sola variable reactiva | | watchObject() | Observa propiedades planas de un objeto | | watchDeep() | Observa propiedades anidadas (user.name, settings.theme) | | watchTree() | Observa estructuras completas y genera diffs |

🧩 Métodos disponibles por utilidad

| Método | watchVar | watchObject | watchDeep | watchTree | |------------------|:----------:|:-------------:|:-----------:|:-----------:| | .get() | ✅ | ✅ | ✅ | ✅ | | .set() | ✅ | ✅ | ✅ | ✅ | | .update() | ✅ | ✅ | ✅ | ✅ | | .subscribe() | ✅ | ✅ | ✅ | ✅ | | .getHistory() | ✅ | ✅ | ✅ | ✅ | | .snapshot() | ❌ | ✅ | ✅ | ✅ | | .reset() | ✅ | ❌ | ❌ | ❌ | | .clone() | ✅ | ❌ | ❌ | ❌ | | .bindTo() | ✅ | ❌ | ❌ | ❌ | | .debug() | ✅ | ✅ | ✅ | ✅ | | .toReactv() | ✅ | ✅ | ✅ | ✅ | | .diff() | ❌ | ❌ | ❌ | ✅ |


📦 Changelog — ReactiveObserver

Todas las modificaciones importantes documentadas por versión.


[1.0.0] — 2025-10-06

✨ Features

  • watchVar() — Observación de variables con .set(), .get(), .subscribe(), .bindTo(), .reset()
  • watchObject() — Observación de propiedades planas con configuración por clave (validate, beforeChange, trackHistory)
  • watchDeep() — Observación de propiedades anidadas con trazabilidad por path (user.name, settings.theme)
  • watchTree() — Observación estructural completa con generación de diffs entre snapshots

🧠 Extensibilidad

  • Middleware por clave o path: validate, beforeChange
  • Historial por propiedad: .getHistory()
  • Depuración avanzada: .debug() con listeners y estado
  • Integración con sistemas reactivos: .toReactv()
  • Sincronización entre observadores: .bindTo() en watchVar

📚 API interna

  • .update(fn) — Actualización funcional
  • .snapshot() — Clonación del estado actual
  • .diff(next) — Comparación estructural en watchTree

🧩 Arquitectura

  • Clase autoejecutable ReactiveObserver con las 4 utilidades encapsuladas
  • Zero-dependencies, compatible con bundlers y tree-shaking
  • Preparado para integración con plugin systems y trazabilidad cruzada

🧪 Ejemplos de uso por utilidad

🔹 watchVar() — Variable reactiva trazable

const count = ReactiveObserver.watchVar(0, (val, prev) => {
  console.log(`Contador: ${prev} → ${val}`);
});

count.set(5);
count.update(v => v + 1);
count.subscribe((val, prev) => console.log('Suscripción:', val));

🔹 watchObject() — Observación de propiedades planas

const user = ReactiveObserver.watchObject(
  { name: 'Arturo', age: 30 },
  {
    name: { trackHistory: true },
    age: {
      beforeChange: v => Math.floor(v),
      validate: v => typeof v === 'number'
    }
  }
);

user.set('name', 'Arturito');
user.update('age', a => a + 1.7); // Cambia a 31
console.log(user.getHistory('name')); // ['Arturo', 'Arturito']

🔹 watchDeep() — Observación de propiedades anidadas

const profile = ReactiveObserver.watchDeep(
  { user: { name: 'Arturo', age: 30 } },
  (val, prev, ctx) => console.log(`Cambio en ${ctx.path}: ${prev} → ${val}`),
  { trackHistory: true }
);

profile.set('user.name', 'Arturito');
profile.update('user.age', a => a + 1);
console.log(profile.getHistory('user.age')); // [30, 31]

🔹 watchTree() — Observación estructural con diffs

const tree = ReactiveObserver.watchTree(
  { user: { name: 'Arturo', age: 30 }, settings: { theme: 'dark' } },
  (val, prev, ctx) => console.log(`Cambio en ${ctx.path}: ${prev} → ${val}`),
  { trackHistory: true }
);

tree.set('settings.theme', 'light');

const changes = tree.diff({
  user: { name: 'Arturo', age: 32 },
  settings: { theme: 'light' }
});

console.table(changes);
/*
[
  { path: 'user.age', type: 'changed', from: 30, to: 32 }
]
*/

🚀 Instalación

npm install reactive-observer
# o simplemente copia la clase:
import { ReactiveObserver } from './ReactiveObserver.js';