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 🙏

© 2025 – Pkg Stats / Ryan Hefner

oso-state-jc

v0.0.6

Published

<img src="https://i.postimg.cc/y8r0kVf9/Dise-o-sin-t-tulo-removebg-preview.png" width="100">

Downloads

11

Readme

🐻 OsoStateJC

OsoStateJC es una librería ligera para la gestión de estado en Angular utilizando Signals. Su objetivo es proporcionar una API fluida e intuitiva para manejar el estado de manera reactiva sin dependencias externas.


📌 Características

Gestión de estado basada en Signals.
API fluida para modificaciones con métodos encadenables.
Soporte para estructuras de datos anidadas y actualizaciones profundas.
Manipulación sencilla de arreglos (agregar, eliminar, actualizar).
Restablecimiento del estado a su valor inicial con un solo método.


🚀 Instalación

Puedes instalar OsoStateJC a través de npm:

npm install oso-state-jc

Luego, impórtalo en tu código:

import { OsoStateJC } from "oso-state-jc";

📖 Uso

🔹 Creación del estado

interface User {
  name: string;
  age: number;
  hobbies: string[];
}

const state = OsoStateJC.create<User>({
  name: "John",
  age: 30,
  hobbies: ["reading", "coding"],
});

📌 API

🔍 Obtener el estado actual (valor estático)

const currentState = state.state;

✏️ Modificar una propiedad

state.modify("name").set("Jane");

🔍 Obtener una propiedad (devuelve un Signal de la propiedad)

const nameSignal = state.modify("name").get();

🔄 Obtener dinámicamente el valor de una propiedad (valor estático)

const dynamicValue = state.modify("name").get()();

🏗️ Manejo de arreglos

Agregar un elemento a un array

state.modify("hobbies").add("gaming");

Eliminar un elemento de un array

state.modify("hobbies").remove((hobby) => hobby === "reading");

🔄 Actualizar un elemento en un array

state.modify("hobbies").update(
  (hobby) => hobby === "coding",
  () => "programming"
);

📌 Modificación de estructuras anidadas

🔹 Modificar una propiedad anidada directamente

state.modify("user").nested("email", "[email protected]");

🌍 Modificar valores en profundidad (Deep Update)

state.modify("user").deep("address.city", "New York");

🔄 Resetear el estado a su valor inicial

state.reset();

Buenas Prácticas

✔️ Utilizar un solo OsoStateJC por dominio de estado para evitar duplicaciones innecesarias.
✔️ No modificar el estado directamente, sino siempre utilizar la API provista.
✔️ Usar Signals en los templates para garantizar la reactividad y evitar cambios inesperados.


⚠️ Consideraciones

⚠️ El estado no persiste entre recargas de página (si necesitas persistencia, complementa con almacenamiento en localStorage o una base de datos).
⚠️ Es una librería enfocada en Angular y Signals, no es compatible con otros frameworks.
⚠️ Diseñada para ser ligera y sin dependencias externas.


🤝 Contribución

¡Las contribuciones son bienvenidas! 🎉
Si deseas mejorar OsoStateJC, por favor abre un issue o envía un pull request.

📩 Contacto: OsoDreamer


📄 Licencia

MIT © OsoDreamer


🎯 Conclusión

OsoStateJC es una solución ligera, eficaz y fácil de usar para gestionar el estado en Angular con Signals. Su API fluida y flexible permite manejar el estado sin comprometer la escalabilidad ni la reactividad de la aplicación. 🚀🐻