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

nanots

v1.0.1

Published

Una librería minimalista para el manejo eficiente del DOM

Readme

🚀 nanots

Una librería minimalista para el manejo eficiente del DOM, inspirada en jQuery pero con un enfoque moderno y ligero.

📦 Instalación

npm install nanots

🎯 Características

  • ✨ API simple y familiar
  • 🪶 Ultra ligero (~3KB minificado)
  • 🔗 Encadenamiento de métodos (method chaining)
  • 📱 Compatible con navegadores modernos
  • 🔧 Escrito en TypeScript
  • 🎯 Sin dependencias

🚀 Uso Básico

Importación

// ES6 Modules
import $n from "nanots";

// CommonJS
const $n = require("nanots");

// Uso directo en el navegador (global)
// La función $n estará disponible globalmente

DOM Ready

$n(() => {
  console.log("DOM está listo!");
});

📚 API Reference

Selección de Elementos

// Seleccionar por CSS selector
const elementos = $n(".mi-clase");
const elemento = $n("#mi-id");
const divs = $n("div");

// Envolver un elemento DOM existente
const elemento = $n(document.getElementById("mi-elemento"));

Manipulación de Clases

$n(".mi-elemento")
  .addClass("nueva-clase")
  .removeClass("clase-vieja")
  .toggleClass("activo");

// Verificar si tiene una clase
if ($n(".mi-elemento").hasClass("activo")) {
  // hacer algo
}

Manejo de Eventos

// Agregar event listener
$n(".boton").on("click", (e) => {
  console.log("Botón clickeado!");
});

// Remover event listener
$n(".boton").off("click", handler);

// Disparar evento
$n(".boton").trigger("click");

Manipulación de Contenido

// Obtener/establecer HTML
const html = $n(".elemento").html();
$n(".elemento").html("<p>Nuevo contenido</p>");

// Obtener/establecer texto
const texto = $n(".elemento").text();
$n(".elemento").text("Nuevo texto");

// Obtener/establecer valor de input
const valor = $n("input").val();
$n("input").val("nuevo valor");

Atributos y Datos

// Obtener/establecer atributos
const src = $n("img").attr("src");
$n("img").attr("src", "nueva-imagen.jpg");

// Verificar si tiene atributo
if ($n("img").hasAttr("alt")) {
  // hacer algo
}

// Trabajar con data attributes
$n(".elemento").data("id", "123");
const id = $n(".elemento").data("id");

Estilos CSS

// Obtener/establecer propiedades CSS
const color = $n(".elemento").css("color");
$n(".elemento").css("color", "red");

// Mostrar/ocultar elementos
$n(".elemento").hide();
$n(".elemento").show();

Manipulación del DOM

// Agregar contenido
$n(".contenedor").append("<p>Al final</p>");
$n(".contenedor").prepend("<p>Al inicio</p>");

// Remover elementos
$n(".elemento").remove();

// Vaciar contenido
$n(".contenedor").empty();

Navegación del DOM

// Obtener padre
const padre = $n(".hijo").parent();

// Obtener hijos
const hijos = $n(".padre").children();

// Buscar dentro del elemento
const encontrados = $n(".contenedor").find(".item");

// Primer y último elemento
const primero = $n(".lista li").first();
const ultimo = $n(".lista li").last();

Filtrado

// Filtrar elementos que coincidan con selector
const activos = $n(".item").filter(".activo");

// Filtrar elementos que NO coincidan con selector
const inactivos = $n(".item").not(".activo");

Iteración

$n(".item").each((elemento, indice) => {
  console.log(`Elemento ${indice}:`, elemento);
});

💡 Ejemplos Prácticos

Formulario Interactivo

$n(() => {
  $n("#mi-formulario").on("submit", (e) => {
    e.preventDefault();

    const nombre = $n("#nombre").val();
    const email = $n("#email").val();

    if (!nombre || !email) {
      $n(".error").text("Por favor completa todos los campos").show();
      return;
    }

    $n(".success").text("Formulario enviado correctamente!").show();
    $n(".error").hide();
  });
});

Toggle de Contenido

$n(".toggle-btn").on("click", () => {
  $n(".contenido")
    .toggleClass("visible")
    .css("display", $n(".contenido").hasClass("visible") ? "block" : "none");
});

Lista Dinámica

$n(".agregar-item").on("click", () => {
  const texto = $n("#nuevo-item").val();
  if (texto) {
    $n(".lista").append(`<li>${texto}</li>`);
    $n("#nuevo-item").val("");
  }
});

$n(".lista").on("click", "li", (e) => {
  $n(e.target).toggleClass("completado");
});

🔗 Encadenamiento

Todos los métodos que modifican elementos retornan la instancia de NanoWrapper, permitiendo encadenar operaciones:

$n(".mi-elemento")
  .addClass("activo")
  .css("color", "blue")
  .text("Texto actualizado")
  .on("click", () => alert("Clickeado!"));

📊 Propiedades

// Obtener número de elementos seleccionados
const cantidad = $n(".items").length;

🌐 Compatibilidad

  • Chrome 60+
  • Firefox 55+
  • Safari 12+
  • Edge 79+

📄 Licencia

ISC

🤝 Contribuir

¡Las contribuciones son bienvenidas! Por favor abre un issue o pull request en nuestro repositorio de GitHub.