node-clima
Advanced tools
Comparing version 1.7.1 to 1.7.2
/*global document */ | ||
(function() { | ||
var source = document.getElementsByClassName('prettyprint source linenums'); | ||
var i = 0; | ||
var lineNumber = 0; | ||
var lineId; | ||
var lines; | ||
var totalLines; | ||
var anchorHash; | ||
(() => { | ||
const source = document.getElementsByClassName('prettyprint source linenums'); | ||
let i = 0; | ||
let lineNumber = 0; | ||
let lineId; | ||
let lines; | ||
let totalLines; | ||
let anchorHash; | ||
@@ -18,3 +18,3 @@ if (source && source[0]) { | ||
lineNumber++; | ||
lineId = 'line' + lineNumber; | ||
lineId = `line${lineNumber}`; | ||
lines[i].id = lineId; | ||
@@ -21,0 +21,0 @@ if (lineId === anchorHash) { |
@@ -14,3 +14,3 @@ "use strict"; | ||
.catch((error) => { | ||
throw new Error('Hubo un problema con la petición fetch'); | ||
throw new Error('There was a problem with the fetch request'); | ||
}); | ||
@@ -17,0 +17,0 @@ } |
{ | ||
"name": "node-clima", | ||
"version": "1.7.1", | ||
"version": "1.7.2", | ||
"description": "Simple wrapper for OpenWeatherMap API", | ||
@@ -25,2 +25,3 @@ "author": "Roberto Serrano Diaz-Grande", | ||
"@babel/preset-env": "^7.7.6", | ||
"@types/node": "^12.12.16", | ||
"@types/node-fetch": "^2.5.4", | ||
@@ -27,0 +28,0 @@ "babel-jest": "^24.9.0", |
[![Build Status](https://travis-ci.org/rsdiaz/node-clima.svg?branch=master)](https://travis-ci.org/rsdiaz/node-clima) | ||
[![Coverage Status](https://coveralls.io/repos/robfree/node-clima/badge.svg?branch=master&service=github)](https://coveralls.io/github/robfree/node-clima?branch=master) | ||
[![Coverage Status](https://coveralls.io/repos/github/rsdiaz/node-clima/badge.svg?branch=master)](https://coveralls.io/github/rsdiaz/node-clima?branch=master) | ||
# JavaScript OpenWeatherMap API for Node.js | ||
@@ -26,10 +27,8 @@ A Node.JS module, which provides an object oriented wrapper for the OpenWeatherMap API. | ||
**currentByCityName** | ||
**Current.byCityName()** | ||
**currentByCityId** | ||
**Current.byCityId()** | ||
**currentByCoordinates** | ||
**Current.byGeographicCoordinates()** | ||
**currentByZip** | ||
### Example | ||
@@ -40,22 +39,23 @@ Print all data to the console. | ||
``` | ||
const Client = require('node-clima').ClientRequest; | ||
const Current = require('node-clima').Current; | ||
const Clima = require('node-clima'); | ||
var apiKey = 'YOUR API KEY' | ||
var client = new Client(); | ||
var current = new Current(apiKey, client); | ||
const c = new Clima({ | ||
format: 'json', // required | ||
units: 'Celsius' // optional | ||
apikey: 'YOUR API KEY' // required | ||
}); | ||
current.byCityName('Tarragona') | ||
.then((data) => { | ||
console.log(data); | ||
}) | ||
.catch((error) => { | ||
console.log(error); | ||
}); | ||
``` | ||
c.currentByCityName({ | ||
cityName: 'London', | ||
callback: function(err, data) { | ||
console.log(data); | ||
} | ||
}); | ||
### Running the Tests | ||
The unit tests are based on the nodeunit module, which may be installed via npm. To run the tests make sure that the npm dependencies are installed by running npm install from the project directory. | ||
The unit tests are based on jest, which may be installed via npm. To run the tests make sure that the npm dependencies are installed by running npm install from the project directory. | ||
$ nodeunit | ||
$ npm run test | ||
@@ -62,0 +62,0 @@ Note that a connection to the internet is required to run the tests. |
@@ -12,3 +12,3 @@ import fetch from 'node-fetch'; | ||
.catch((error) => { | ||
throw new Error('Hubo un problema con la petición fetch'); | ||
throw new Error('There was a problem with the fetch request'); | ||
}); | ||
@@ -15,0 +15,0 @@ |
@@ -26,5 +26,5 @@ import { ClientRequest } from '../lib/clientrequest'; | ||
test('the fetch fails with an error', () => { | ||
return expect(client.makeRequest('jhjhk')).rejects.toThrow('Hubo un problema con la petición fetch'); | ||
return expect(client.makeRequest('jhjhk')).rejects.toThrow('There was a problem with the fetch request'); | ||
}); | ||
}); |
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
50
1055560
8