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
+3 -3
View File
@@ -110,10 +110,10 @@ TemplateMaps.prototype._checkInvalidTemplate = function (template) {
if (!placeholderKey.match(_reValidPlaceholderIdentifier)) {
return new Error("Invalid characters in placeholder name '" + placeholderKey + "'");
}
if (!placeholders[placeholderKey].hasOwnProperty('default')) {
if (!Object.prototype.hasOwnProperty.call(placeholders[placeholderKey], 'default')) {
return new Error("Missing default for placeholder '" + placeholderKey + "'");
}
if (!placeholders[placeholderKey].hasOwnProperty('type')) {
if (!Object.prototype.hasOwnProperty.call(placeholders[placeholderKey], 'type')) {
return new Error("Missing type for placeholder '" + placeholderKey + "'");
}
}
@@ -449,7 +449,7 @@ TemplateMaps.prototype.instance = function (template, params) {
var all_params = {};
var phold = template.placeholders || {};
Object.keys(phold).forEach(function (k) {
var val = params.hasOwnProperty(k) ? params[k] : phold[k].default;
var val = Object.prototype.hasOwnProperty.call(params, k) ? params[k] : phold[k].default;
var type = phold[k].type;
// properly escape
if (type === 'sql_literal') {