cleanup: Don't assume hasOwnProperty() method on objects
Since ES5, it is possible to create objects with no prototype at all: let foo = Object.create(null); Those object won't have any builtin properties like hasOwnProperty(), which is why eslint added a corresponding rule to its default rule set. While this isn't an issue that affects our code, there's no harm in fol- lowing the recommendation and call the method through Object.prototype. https://gitlab.gnome.org/GNOME/gnome-shell/merge_requests/716
This commit is contained in:
parent
451f4e3636
commit
0ee7f02f8e
@ -861,7 +861,7 @@ var LayoutManager = GObject.registerClass({
|
|||||||
// We can't use Params.parse here because we want to drop
|
// We can't use Params.parse here because we want to drop
|
||||||
// the extra values like ancestorData.actor
|
// the extra values like ancestorData.actor
|
||||||
for (let prop in defaultParams) {
|
for (let prop in defaultParams) {
|
||||||
if (!params.hasOwnProperty(prop))
|
if (!Object.prototype.hasOwnProperty.call(params, prop))
|
||||||
params[prop] = ancestorData[prop];
|
params[prop] = ancestorData[prop];
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -111,7 +111,7 @@ function _loadMode(file, info) {
|
|||||||
let suffix = name.indexOf('.json');
|
let suffix = name.indexOf('.json');
|
||||||
let modeName = suffix == -1 ? name : name.slice(name, suffix);
|
let modeName = suffix == -1 ? name : name.slice(name, suffix);
|
||||||
|
|
||||||
if (_modes.hasOwnProperty(modeName))
|
if (Object.prototype.hasOwnProperty.call(_modes, modeName))
|
||||||
return;
|
return;
|
||||||
|
|
||||||
let fileContent, success_, newMode;
|
let fileContent, success_, newMode;
|
||||||
|
Loading…
Reference in New Issue
Block a user