Avoid calling Object.prototype methods directly on object instances

This commit is contained in:
Daniel García Aubert
2019-10-21 23:33:27 +02:00
parent d89e785440
commit 7a1d2ca205
42 changed files with 166 additions and 166 deletions
+6 -6
View File
@@ -199,10 +199,10 @@ TestClient.prototype.getWidget = function (widgetName, params, callback) {
self.keysToDelete['user:localhost:mapviews:global'] = 5;
var urlParams = {
own_filter: params.hasOwnProperty('own_filter') ? params.own_filter : 1
own_filter: Object.prototype.hasOwnProperty.call(params, 'own_filter') ? params.own_filter : 1
};
['bbox', 'bins', 'start', 'end'].forEach(function (extraParam) {
if (params.hasOwnProperty(extraParam)) {
if (Object.prototype.hasOwnProperty.call(params, extraParam)) {
urlParams[extraParam] = params[extraParam];
}
});
@@ -309,7 +309,7 @@ TestClient.prototype.widgetSearch = function (widgetName, userQuery, params, cal
var urlParams = {
q: userQuery,
own_filter: params.hasOwnProperty('own_filter') ? params.own_filter : 1
own_filter: Object.prototype.hasOwnProperty.call(params, 'own_filter') ? params.own_filter : 1
};
if (params && params.bbox) {
urlParams.bbox = params.bbox;
@@ -478,15 +478,15 @@ TestClient.prototype.getDataview = function (dataviewName, params, callback) {
self.keysToDelete['user:localhost:mapviews:global'] = 5;
var urlParams = {};
if (params.hasOwnProperty('no_filters')) {
if (Object.prototype.hasOwnProperty.call(params, 'no_filters')) {
urlParams.no_filters = params.no_filters;
}
if (params.hasOwnProperty('own_filter')) {
if (Object.prototype.hasOwnProperty.call(params, 'own_filter')) {
urlParams.own_filter = params.own_filter;
}
['bbox', 'bins', 'start', 'end', 'aggregation', 'offset', 'categories'].forEach(function (extraParam) {
if (params.hasOwnProperty(extraParam)) {
if (Object.prototype.hasOwnProperty.call(params, extraParam)) {
urlParams[extraParam] = params[extraParam];
}
});
+8 -8
View File
@@ -45,10 +45,10 @@ function lzma_compress_to_base64 (payload, mode, callback) {
// Check that the response headers do not request caching
// Throws on failure
function checkNoCache (res) {
assert.ok(!res.headers.hasOwnProperty('x-cache-channel'));
assert.ok(!res.headers.hasOwnProperty('surrogate-key'));
assert.ok(!res.headers.hasOwnProperty('cache-control')); // is this correct ?
assert.ok(!res.headers.hasOwnProperty('last-modified')); // is this correct ?
assert.ok(!Object.prototype.hasOwnProperty.call(res.headers, 'x-cache-channel'));
assert.ok(!Object.prototype.hasOwnProperty.call(res.headers, 'surrogate-key'));
assert.ok(!Object.prototype.hasOwnProperty.call(res.headers, 'cache-control')); // is this correct ?
assert.ok(!Object.prototype.hasOwnProperty.call(res.headers, 'last-modified')); // is this correct ?
}
/**
@@ -57,13 +57,13 @@ function checkNoCache (res) {
* @param res
*/
function checkCache (res) {
assert.ok(res.headers.hasOwnProperty('x-cache-channel'));
assert.ok(res.headers.hasOwnProperty('cache-control'));
assert.ok(res.headers.hasOwnProperty('last-modified'));
assert.ok(Object.prototype.hasOwnProperty.call(res.headers, 'x-cache-channel'));
assert.ok(Object.prototype.hasOwnProperty.call(res.headers, 'cache-control'));
assert.ok(Object.prototype.hasOwnProperty.call(res.headers, 'last-modified'));
}
function checkSurrogateKey (res, expectedKey) {
assert.ok(res.headers.hasOwnProperty('surrogate-key'));
assert.ok(Object.prototype.hasOwnProperty.call(res.headers, 'surrogate-key'));
function createSet (keys, key) {
keys[key] = true;