mirror of
https://github.com/Leaflet/Leaflet.git
synced 2025-08-15 22:36:58 +00:00
Prefer Object.hasOwn()
over Object.prototype.hasOwnProperty()
(#8684)
This commit is contained in:
@ -40,6 +40,7 @@ module.exports = {
|
||||
'wrap-iife': 'off',
|
||||
// TODO: Re-enable the rules below and fix the linting issues.
|
||||
'no-invalid-this': 'off',
|
||||
'prefer-object-has-own': 'error',
|
||||
'prefer-spread': 'off'
|
||||
},
|
||||
overrides: [
|
||||
|
@ -37,7 +37,7 @@ Class.extend = function (props) {
|
||||
|
||||
// inherit parent's statics
|
||||
for (const i in this) {
|
||||
if (Object.prototype.hasOwnProperty.call(this, i) && i !== 'prototype' && i !== '__super__') {
|
||||
if (Object.hasOwn(this, i) && i !== 'prototype' && i !== '__super__') {
|
||||
NewClass[i] = this[i];
|
||||
}
|
||||
}
|
||||
|
@ -100,7 +100,7 @@ export function splitWords(str) {
|
||||
// @function setOptions(obj: Object, options: Object): Object
|
||||
// Merges the given properties to the `options` of the `obj` object, returning the resulting options. See `Class options`. Has an `L.setOptions` shortcut.
|
||||
export function setOptions(obj, options) {
|
||||
if (!Object.prototype.hasOwnProperty.call(obj, 'options')) {
|
||||
if (!Object.hasOwn(obj, 'options')) {
|
||||
obj.options = obj.options ? Object.create(obj.options) : {};
|
||||
}
|
||||
for (const i in options) {
|
||||
|
@ -77,7 +77,7 @@ export const VideoOverlay = ImageOverlay.extend({
|
||||
|
||||
if (!Array.isArray(this._url)) { this._url = [this._url]; }
|
||||
|
||||
if (!this.options.keepAspectRatio && Object.prototype.hasOwnProperty.call(vid.style, 'objectFit')) {
|
||||
if (!this.options.keepAspectRatio && Object.hasOwn(vid.style, 'objectFit')) {
|
||||
vid.style['objectFit'] = 'fill';
|
||||
}
|
||||
vid.autoplay = !!this.options.autoplay;
|
||||
|
@ -105,7 +105,7 @@ export const Path = Layer.extend({
|
||||
Util.setOptions(this, style);
|
||||
if (this._renderer) {
|
||||
this._renderer._updateStyle(this);
|
||||
if (this.options.stroke && style && Object.prototype.hasOwnProperty.call(style, 'weight')) {
|
||||
if (this.options.stroke && style && Object.hasOwn(style, 'weight')) {
|
||||
this._updateBounds();
|
||||
}
|
||||
}
|
||||
|
Reference in New Issue
Block a user