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

@i-giann/open-meteo-wrapper

v1.0.1

Published

Un wrapper completo para la API de Open-Meteo con hooks de React y servicios reutilizables

Readme

@i-giann/open-meteo-wrapper

Un wrapper completo para la API de Open-Meteo que proporciona hooks de React y servicios reutilizables para obtener datos meteorológicos.

🌟 Características

  • Hook de React optimizado con caché automático
  • Servicio puro sin dependencias de React
  • TypeScript completo con tipos seguros
  • Caché inteligente para optimizar las llamadas a la API
  • Manejo de errores robusto
  • Auto-refresh programable
  • Zero configuración - funciona out-of-the-box

📦 Instalación

npm install @i-giann/open-meteo-wrapper

🚀 Uso Rápido

Con React Hook

import { useWeather } from "@i-giann/open-meteo-wrapper";

function WeatherComponent() {
  const { data, isLoading, error, fetchWeather } = useWeather();

  useEffect(() => {
    fetchWeather({
      latitude: 40.7128,
      longitude: -74.006,
      hourly: ["temperature_2m", "weather_code"],
      daily: ["temperature_2m_max", "temperature_2m_min"],
    });
  }, []);

  if (isLoading) return <div>Cargando...</div>;
  if (error) return <div>Error: {error.error}</div>;

  return (
    <div>
      <h1>Clima Actual</h1>
      <p>Temperatura: {data?.currentDay?.temperatureMax?.value}°C</p>
    </div>
  );
}

Con Servicio Puro

import { fetchWeather } from "@i-giann/open-meteo-wrapper";

async function getWeatherData() {
  const result = await fetchWeather({
    latitude: 40.7128,
    longitude: -74.006,
    hourly: ["temperature_2m", "relative_humidity_2m"],
    daily: ["temperature_2m_max", "temperature_2m_min"],
  });

  if ("error" in result) {
    console.error("Error:", result.error);
    return;
  }

  console.log("Datos meteorológicos:", result);
}

📋 API Reference

useWeather Hook

const {
  data, // Datos meteorológicos estructurados
  currentDay, // Datos del día actual
  pastDays, // Datos de días pasados
  forecast, // Pronóstico futuro
  currentHour, // Datos de la hora actual
  isLoading, // Estado de carga
  error, // Error si existe
  fetchWeather, // Función para obtener datos
  setAutoRefresh, // Configurar auto-refresh
  clearError, // Limpiar errores
} = useWeather();

fetchWeather Service

const result = await fetchWeather({
  latitude: number,        // Latitud (requerido)
  longitude: number,       // Longitud (requerido)
  hourly?: HourlyParams[], // Parámetros por hora
  daily?: DailyParams[],   // Parámetros diarios
  timezone?: string,       // Zona horaria
  past_days?: number,      // Días pasados
  forecast_days?: number   // Días de pronóstico
});

🎯 Parámetros Disponibles

Parámetros Horarios (HourlyParams)

  • temperature_2m - Temperatura a 2m
  • relative_humidity_2m - Humedad relativa
  • weather_code - Código meteorológico WMO
  • wind_speed_10m - Velocidad del viento
  • precipitation - Precipitación
  • Y muchos más...

Parámetros Diarios (DailyParams)

  • temperature_2m_max - Temperatura máxima
  • temperature_2m_min - Temperatura mínima
  • sunrise - Hora de salida del sol
  • sunset - Hora de puesta del sol

🔧 Configuración Avanzada

Auto-refresh

const { setAutoRefresh } = useWeather();
setAutoRefresh(true); // Actualización automática a medianoche

Caché personalizado

El hook incluye caché inteligente de 10 minutos por defecto.

🌍 Ejemplos Completos

Visita la carpeta docs/ para ejemplos completos y casos de uso avanzados.

📄 Licencia

MIT

🤝 Contribuciones

¡Las contribuciones son bienvenidas! Por favor, abre un issue o pull request.