Avoid calling Object.prototype methods directly on object instances
This commit is contained in:
@@ -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') {
|
||||
|
||||
Reference in New Issue
Block a user