Don't call hasOwnProperty directly
Calling it directly might make it difficult to detect bugs, particularly when we don't trust the data we receive: https://eslint.org/docs/rules/no-prototype-builtins If we trust the data we receive, then IMHO we shouldn't even check for `hasOwnProperty`, since we know what we're going to receive.
This commit is contained in:
@@ -75,7 +75,7 @@
|
|||||||
this.progressColumnValues = [ this.progressLabel ];
|
this.progressColumnValues = [ this.progressLabel ];
|
||||||
|
|
||||||
for (key in data) {
|
for (key in data) {
|
||||||
if (data.hasOwnProperty(key)) {
|
if (Object.prototype.hasOwnProperty.call(data, key)) {
|
||||||
this.xColumnValues.push(key);
|
this.xColumnValues.push(key);
|
||||||
this.progressColumnValues.push(data[key]);
|
this.progressColumnValues.push(data[key]);
|
||||||
|
|
||||||
@@ -105,7 +105,7 @@
|
|||||||
this.successfulColumnValues = [ this.successLabel ];
|
this.successfulColumnValues = [ this.successLabel ];
|
||||||
|
|
||||||
for (key in data) {
|
for (key in data) {
|
||||||
if (data.hasOwnProperty(key)) {
|
if (Object.prototype.hasOwnProperty.call(data, key)) {
|
||||||
this.addXColumnValue(key);
|
this.addXColumnValue(key);
|
||||||
this.successfulColumnValues.push(data[key]);
|
this.successfulColumnValues.push(data[key]);
|
||||||
}
|
}
|
||||||
@@ -130,7 +130,7 @@
|
|||||||
|
|
||||||
this.achievements = [];
|
this.achievements = [];
|
||||||
for (group in data) {
|
for (group in data) {
|
||||||
if (data.hasOwnProperty(group)) {
|
if (Object.prototype.hasOwnProperty.call(data, group)) {
|
||||||
this.addXColumnValue(group);
|
this.addXColumnValue(group);
|
||||||
this.achievements.push({
|
this.achievements.push({
|
||||||
value: this.formatGroup(group),
|
value: this.formatGroup(group),
|
||||||
@@ -169,7 +169,7 @@
|
|||||||
color: function (color, d) {
|
color: function (color, d) {
|
||||||
var achievement;
|
var achievement;
|
||||||
|
|
||||||
if (d.id === this.successfulColumnValues[0] || !d.hasOwnProperty('x')) {
|
if (d.id === this.successfulColumnValues[0] || !Object.prototype.hasOwnProperty.call(d, 'x')) {
|
||||||
return color;
|
return color;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user