New Case Study:See how Anthropic automated 95% of dependency reviews with Socket.Learn More
Socket
Sign inDemoInstall
Socket

@ifraan_/weather.js

Package Overview
Dependencies
Maintainers
0
Versions
3
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

@ifraan_/weather.js

Wrapper of the unnoficial msn weather api

  • 1.2.0
  • latest
  • Source
  • npm
  • Socket score

Version published
Maintainers
0
Created
Source

weather.js

CodeFactor NPM-Version NPM-Downloads Github Stars Issues

This a typesafe wrapper of the unnoficial MSN weather API

Instalattion

No apiKey, its free.

Dependencies

axios fast-xml-parser

To install use:

npm i @ifraan_/weather.js

You must use API.search before using any other method

search can take options parameters

await search('Location', {
    degree: 'C', // Either C for Celcius or F for Fahrenheit, default is F
    lang: 'en-UK', // Language code for the results, default is en-US
    timeout: 5_000 // Timeout in miliseconds, default is 10_000
})
MethodsDescription
infoGenerical info
currentCurrent weather
forecastForecast for the next 5 days

Example code:

const { API } = require('@ifraan_/weather.js');

try {
    const city = await API.search('Broklyn, NY', { degree: 'F', lang: 'en-US' })
    console.log('Info: ', city.info())
    /*
    Info:  {
        location_code: 'wc:USNY0996',
        location_name: 'Brooklyn, NY',
        degree: 'F',
        provider: { name: 'Foreca', url: 'http://www.foreca.com/' },
        coords: { latitude: '40.692', longitude: '-73.99' },
        timezone: '0'
    }
    */
    console.log('Current: ', city.current())
    /*
    Current:  {
        temperature: '85',
        skycode: '32',
        skytext: 'Sunny',
        date: '2024-07-08',
        observationtime: '13:20:00',
        observationpoint: 'Brooklyn, NY',
        feelslike: '99',
        humidity: '70',
        winddisplay: '3 mph Northeast',
        day: 'Monday',
        shortday: 'Mon',
        windspeed: '3 mph'
    }
    */
    console.log('Forecast: ', city.forecast())
    /*
    Forecast:  [
        {
            low: '75',
            high: '90',
            skycodeday: '34',
            skytextday: 'Mostly sunny',
            date: '2024-07-08',
            day: 'Monday',
            shortday: 'Mon',
            precip: '6'
        },
        ...
    ]
    */
} catch (err) {
    console.log(err)
}

Disclaimer

This project is fully for educational purposes.

Keywords

FAQs

Package last updated on 10 Jul 2024

Did you know?

Socket

Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.

Install

Related posts

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc