Socket
Socket
Sign inDemoInstall

openweather-api-node

Package Overview
Dependencies
2
Maintainers
1
Versions
23
Alerts
File Explorer

Advanced tools

Install Socket

Detect and block malicious and high-risk dependencies

Install

Comparing version 1.3.2 to 1.4.0

src/index.js

4

CHANGELOG.md
# Changelog
All notable changes to this project will be documented in this file.
## `v1.4.0` - 12.02.2022
### Added
* `getAllLocations` method
## `v1.3.0` - 18.01.2022

@@ -5,0 +9,0 @@ ### Added

2

examples/air-pollution.js

@@ -1,2 +0,2 @@

const OpenWeatherAPI = require("../index")
const OpenWeatherAPI = require("..")

@@ -3,0 +3,0 @@ const location = "Paris"

@@ -1,2 +0,2 @@

const OpenWeatherAPI = require("../index")
const OpenWeatherAPI = require("..")

@@ -3,0 +3,0 @@ // Set global key, location and units

@@ -1,2 +0,2 @@

const OpenWeatherAPI = require("../index")
const OpenWeatherAPI = require("..")

@@ -3,0 +3,0 @@ // Set global key, location and units

@@ -1,2 +0,2 @@

const OpenWeatherAPI = require("../index")
const OpenWeatherAPI = require("..")

@@ -3,0 +3,0 @@ // Set global key, location and units

@@ -1,2 +0,2 @@

const OpenWeatherAPI = require("../index")
const OpenWeatherAPI = require("..")

@@ -3,0 +3,0 @@ // Set global key, location and units

@@ -1,2 +0,2 @@

const OpenWeatherAPI = require("../index")
const OpenWeatherAPI = require("..")

@@ -3,0 +3,0 @@ // Set global key, location and units

{
"name": "openweather-api-node",
"version": "1.3.2",
"version": "1.4.0",
"description": "Simple Node.js package that makes it easy to work with OpenWeather API",
"main": "index.js",
"main": "src/index.js",
"scripts": {

@@ -7,0 +7,0 @@ "test": "mocha"

@@ -104,2 +104,3 @@ <br>

* [getLocation][gloc]
* [getAllLocations][gallloc]
* [Getting & Manipulating Weather Data][gcur]

@@ -325,2 +326,22 @@ * [getCurrent][gcur]

## `async` getAllLocations(query, options = {})
**Description:**
Getter for all locations from query
**Arguments:**
* **query** - query used to search the locations
* **options** - options used only for this call (defaults to empty object)
**Returns:**
Array of [Location Objects][lobj] - `Array`
**Example:**
```js
let locations = await weather.getAllLocations("London")
```
*See also:* [options][opt]
## `async` getCurrent(options = {})

@@ -787,2 +808,3 @@

[gloc]: #async-getlocationoptions
[gallloc]: #async-getAllLocationsquery-options--
[gcur]: #async-getcurrentoptions

@@ -789,0 +811,0 @@ [gminutely]: #async-getminutelyforecastlimit--numberpositive_infinity-options--

const fs = require("fs")
const assert = require("assert")
const OpenWeatherAPI = require("../index")
const OpenWeatherAPI = require("..")

@@ -129,3 +129,3 @@ // ! Remeber to specify key in key.txt file

} catch (err) {
assert(err.message.toLowerCase().includes("no location or time specified"))
assert(err.message.toLowerCase().includes("provide time"))
return

@@ -132,0 +132,0 @@ }

const fs = require("fs")
const assert = require("assert")
const OpenWeatherAPI = require("../index")
const OpenWeatherAPI = require("..")

@@ -22,2 +22,7 @@ // ! Remeber to specify key in key.txt file

it("gets all locations", async () => {
let locations = await weather.getAllLocations("London")
assert(locations.length == 5)
})
it("gets current", async () => {

@@ -24,0 +29,0 @@ weather.setLocationByName("warsaw")

const fs = require("fs")
const assert = require("assert")
const OpenWeatherAPI = require("../index")
const OpenWeatherAPI = require("..")

@@ -5,0 +5,0 @@ // ! Remeber to specify key in key.txt file

@@ -148,2 +148,10 @@ export = OpenWeatherAPI;

/**
* Getter for locations from query
*
* @param {String} query - query used to search the locations (`q` parameter [here](https://openweathermap.org/api/geocoding-api#direct_name))
* @param {Options} [options={}] - options used only for this call
* @returns {Promise<Location[]>} all found locations
*/
getAllLocations(query: string, options?: Options): Promise<Location[]>;
/**
* Getter for current weather

@@ -150,0 +158,0 @@ *

SocketSocket SOC 2 Logo

Product

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

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc