ispapi-apiconnector
Advanced tools
Comparing version 4.0.5 to 4.0.6
@@ -91,3 +91,3 @@ /* | ||
else { | ||
c.on("error", function(/*r*/) { | ||
c.on("error", function( /*r*/ ) { | ||
//console.error('ispapi-apiconnector: error event thrown in request method but no error callback method provided.'); | ||
@@ -108,3 +108,3 @@ //console.error(JSON.stringify(r["as_" + p_type]())); | ||
options.port = ( | ||
tmp.port || (tmp.protocol.match(/^https/i) ? '443' : '80') | ||
tmp.port || (/^https/i.test(tmp.protocol) ? '443' : '80') | ||
); | ||
@@ -127,3 +127,3 @@ options.protocol = tmp.protocol; | ||
p_uri = "https://coreapi.1api.net/api/call.cgi"; | ||
if (!p_uri.match(/^(http|https):\/\//)) | ||
if (!/^(http|https):\/\//.test(p_uri)) | ||
throw new Error("Unsupported protocol within api connection uri."); | ||
@@ -130,0 +130,0 @@ |
@@ -0,1 +1,7 @@ | ||
4.0.6 / 2017-02-27 | ||
=================== | ||
* replaced regular expression match with test | ||
* moved comments | ||
* replaced for in with Object.keys / forEach | ||
4.0.5 / 2017-02-15 | ||
@@ -2,0 +8,0 @@ =================== |
{ | ||
"name": "ispapi-apiconnector", | ||
"description": "1API API Connector for node.js", | ||
"version": "4.0.5", | ||
"version": "4.0.6", | ||
"author": { | ||
@@ -6,0 +6,0 @@ "name": "Kai Schwarz", |
@@ -70,9 +70,10 @@ /* | ||
); | ||
//250s (to be sure to get an API response) | ||
req.on('socket', function(socket) { | ||
socket.setTimeout(250000, function() { //250s (to be sure to get an API response) | ||
socket.setTimeout(250000, function() { | ||
req.abort(); | ||
}); | ||
}); | ||
//e.message = 'problem with request: ' + e.message; | ||
req.on('error', function() { | ||
//e.message = 'problem with request: ' + e.message; | ||
this.emit('error', new Response(Response.responses.error, this.cmd)); | ||
@@ -79,0 +80,0 @@ }.bind(this)); |
@@ -249,3 +249,4 @@ /* | ||
Object.keys(d.PROPERTY).forEach(function(key) { | ||
if (!key.match(this.colregexp)) delete d.PROPERTY[key]; | ||
if (!this.colregexp.test(key)) | ||
delete d.PROPERTY[key]; | ||
}.bind(this)); | ||
@@ -261,10 +262,10 @@ } | ||
as_list: function() { | ||
var r, tmp, key, row2, i, count, keys; | ||
var r, tmp, row2, i, count, keys; | ||
r = this.as_hash(); | ||
tmp = {}; | ||
count = 0; | ||
for (key in r) { | ||
if (r.hasOwnProperty(key) && !key.match(/^PROPERTY$/)) | ||
Object.keys(r).forEach(function(key) { | ||
if (key !== 'PROPERTY') | ||
tmp[key] = r[key]; | ||
} | ||
}); | ||
if (r.CODE === "200") { | ||
@@ -274,3 +275,3 @@ tmp.LIST = []; | ||
keys = Object.keys(r.PROPERTY).filter(function(key) { | ||
return !key.match(Response.pagerRegexp); // paging info | ||
return !Response.pagerRegexp.test(key); // paging info | ||
}); | ||
@@ -363,11 +364,11 @@ keys.forEach(function(key) { | ||
columns: function() { | ||
var key, cols = [], | ||
props = this.properties(), | ||
regexp = Response.pagerRegexp; | ||
var props, regexp; | ||
props = this.properties(); | ||
regexp = Response.pagerRegexp; | ||
if (props) { | ||
for (key in props) { | ||
if (props.hasOwnProperty(key) && !key.match(regexp)) cols.push(key); | ||
} | ||
return Object.keys(props).filter(function(key) { | ||
return !regexp.test(key); | ||
}); | ||
} | ||
return cols; | ||
return []; | ||
}, | ||
@@ -374,0 +375,0 @@ /** |
78773
1677