Huge News!Announcing our $40M Series B led by Abstract Ventures.Learn More
Socket
Sign inDemoInstall
Socket

node-clima

Package Overview
Dependencies
Maintainers
1
Versions
21
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

node-clima - npm Package Compare versions

Comparing version 0.0.3 to 0.0.4

11

lib/node-clima.js

@@ -35,2 +35,5 @@ var request = require('request');

}
else {
throw new Error('Format is required.');
}
if (obj.units) {

@@ -48,5 +51,6 @@ if (metricUnits.indexOf(obj.units) > -1) {

clima.prototype.url = 'http://api.openweathermap.org/data/2.5/weather';
clima.prototype.format = 'json';
clima.prototype.units = 'Kelvin';
clima.prototype.format = '';
// You can call by city name or city name and country code.

@@ -114,2 +118,5 @@ // API responds with a list of results that match a searching word.

// check format for call
if(this.format === 'xml') obj.qs['mode'] = 'xml';
// check units for call
if (this.units === 'Celsius') {

@@ -131,4 +138,4 @@ obj.qs['units'] = 'metric';

}
// console.log(response.statusCode);
if ((response.statusCode === 200) || (response.statusCode === 304)) {
// console.log(body);
callback(err, body);

@@ -135,0 +142,0 @@ }

5

package.json
{
"name": "node-clima",
"version": "0.0.3",
"version": "0.0.4",
"description": "Simple wrapper for OpenWeatherMap API",

@@ -35,3 +35,4 @@ "author": "Roberto Serrano Diaz-Grande",

"http",
"OpenWeatherMap"
"OpenWeatherMap",
"clima"
],

@@ -38,0 +39,0 @@ "keywords": [

@@ -10,19 +10,28 @@ var clima = require('../lib/node-clima.js');

module.exports = {
'Opciones pasadas al constructor invalidas.': function(test) {
'Invalid options passed to constructor.': function(test) {
test.expect(1);
test.throws(function(){
c = new clima();
}, Error, 'Opciones pasadas al constructor invalidas, no lanzo error');
}, Error, 'Invalid options passed to constructor, did not throw error.');
test.done();
},
'Tipo de datos format pasados al constructor invalido': function(test) {
'Format is required': function(test) {
test.expect(1);
test.throws(function(){
c = new clima({
});
}, Error, 'Format is required, did not throw error');
test.done();
},
'Invalid format': function(test) {
test.expect(1);
test.throws(function() {
var c = new clima({
format: ['212', '212']
format: 'asd'
})
}, Error, 'Tipo de datos format invalido');
}, Error, 'Invalid format, did not throw error.');
test.done();
},
'Tipo de datos units pasados al constructor invalido': function(test) {
'Invalid units': function(test) {
test.expect(1);

@@ -33,3 +42,3 @@ test.throws(function() {

})
}, Error, 'Tipo de datos format invalido');
}, Error, 'Invalid units, did not throw error.');
test.done();

@@ -36,0 +45,0 @@ },

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