Do not access Object.prototype method 'hasOwnProperty' from target object.
449 const tables = []
450
451 for (const key in nuFORM.tableSchema) {
452 if (nuFORM.tableSchema.hasOwnProperty(key)) {453 if (nuSERVERRESPONSE.viewSchema.indexOf(key) == -1) {
454 tables.push(key)
455 }
Do not access Object.prototype method 'hasOwnProperty' from target object.
1216 let f = ''
1217
1218 for (const k in window) {
1219 if (window.hasOwnProperty(k)) {1220 if (String(k).substr(0, 2) === 'nu') {
1221 f += k + '\n'
1222 }
Do not access Object.prototype method 'hasOwnProperty' from target object.
447
448 const errorCode = messageObject.errorCode
449 let responseObject = null
450 if (messageObject.hasOwnProperty('data')) {451 responseObject = /** @type {Object} */ (
452 JSON.parse(messageObject.data))
453 }
Do not access Object.prototype method 'hasOwnProperty' from target object.
207 }
208 }
209 for (i in overrides) {
210 if (overrides.hasOwnProperty(i)) { 211 fns[i] = opts[i] || this._defaults[i] || null
212 }
213 }
Do not access Object.prototype method 'hasOwnProperty' from target object.
172 let overrides; let i
173
174 for (const attrName in this._defaults) {
175 if (this._defaults.hasOwnProperty(attrName)) { 176 const attrValue = $input.attr('time:' + attrName)
177 if (attrValue) {
178 try {
Do not access Object.prototype method 'hasOwnProperty' from target object.
1848 }
1849 }
1850 for (prop in fns) {
1851 if (fns.hasOwnProperty(prop)) {1852 overrides[prop] = fns[prop]
1853 if (!name_clone) { name_clone = $.extend({}, name) }
1854 delete name_clone[prop]
Do not access Object.prototype method 'hasOwnProperty' from target object.
1842 max = name.maxDateTime
1843 }
1844 for (prop in overrides) {
1845 if (overrides.hasOwnProperty(prop) && name[prop]) {1846 fns[prop] = name[prop]
1847 }
1848 }
Do not access Object.prototype method 'hasOwnProperty' from target object.
1824 max = value
1825 } else if (name === 'onSelect') {
1826 onselect = value
1827 } else if (overrides.hasOwnProperty(name)) {1828 if (typeof (value) === 'undefined') {
1829 return overrides[name]
1830 }
Do not access Object.prototype method 'hasOwnProperty' from target object.
1899 var isEmptyObject = function (obj) {
1900 let prop
1901 for (prop in obj) {
1902 if (obj.hasOwnProperty(prop)) {1903 return false
1904 }
1905 }
Do not access Object.prototype method 'hasOwnProperty' from target object.
235 if (j > 0) {
236 intv = Math.abs(d[j][1] - d[j - 1][1])
237 stats.intervals.push(intv)
238 if (stats.frequencies.hasOwnProperty(intv)) {239 stats.frequencies[intv] += 1
240 } else {
241 stats.frequencies[intv] = 1
Do not access Object.prototype method 'hasOwnProperty' from target object.
215 if (j > 0) {
216 intv = Math.abs(d[j][0] - d[j - 1][0])
217 stats.intervals.push(intv)
218 if (stats.frequencies.hasOwnProperty(intv)) {219 stats.frequencies[intv] += 1
220 } else {
221 stats.frequencies[intv] = 1
Do not access Object.prototype method 'hasOwnProperty' from target object.
809 // If any series attached to axis is not a bar, wont force 0.
810 if (doforce && s.renderer.constructor !== $.jqplot.BarRenderer) {
811 doforce = false
812 } else if (doforce && this._options.hasOwnProperty('forceTickAt0') && this._options.forceTickAt0 == false) { 813 doforce = false
814 } else if (doforce && s.renderer.constructor === $.jqplot.BarRenderer) {
815 if (s.barDirection == 'vertical' && this.name != 'xaxis' && this.name != 'x2axis') {
Do not access Object.prototype method 'hasOwnProperty' from target object.
8177 a.borderWidth = ax.borderWidth
8178 if (ax._ticks && ax._ticks[0]) {
8179 for (nn in a.ticks) {
8180 if (ax._ticks[0].hasOwnProperty(nn)) { 8181 a.ticks[nn] = ax._ticks[0][nn]
8182 } else if (ax._ticks[0]._elem) {
8183 a.ticks[nn] = ax._ticks[0]._elem.css(nn)
Do not access Object.prototype method 'hasOwnProperty' from target object.
8281 if (!name && this.activeTheme && this.activeTheme._name) {
8282 name = this.activeTheme._name
8283 }
8284 if (!this.themes.hasOwnProperty(name)) { 8285 throw new Error('No theme of that name')
8286 } else {
8287 const th = this.themes[name]
Do not access Object.prototype method 'hasOwnProperty' from target object.
8421 if (!theme._name) {
8422 theme._name = Date.parse(new Date())
8423 }
8424 if (!this.themes.hasOwnProperty(theme._name)) { 8425 this.themes[theme._name] = theme
8426 } else {
8427 throw new Error('jqplot.ThemeEngine Error: Theme already in use')
Do not access Object.prototype method 'hasOwnProperty' from target object.
8508 obj1[key] = clone(obj2[key])
8509 }
8510 if (obj2[key] != null && typeof (obj2[key]) === 'object') {
8511 if (!obj1.hasOwnProperty(key)) { 8512 obj1[key] = {}
8513 }
8514 merge(obj1[key], obj2[key])
Do not access Object.prototype method 'hasOwnProperty' from target object.
8586 if (oldName == 'Default' || newName == 'Default') {
8587 throw new Error('jqplot.ThemeEngine Error: Cannot rename from/to Default')
8588 }
8589 if (this.themes.hasOwnProperty(newName)) { 8590 throw new Error('jqplot.ThemeEngine Error: New name already in use.')
8591 } else if (this.themes.hasOwnProperty(oldName)) {
8592 const th = this.copy(oldName, newName)
Do not access Object.prototype method 'hasOwnProperty' from target object.
8588 }
8589 if (this.themes.hasOwnProperty(newName)) {
8590 throw new Error('jqplot.ThemeEngine Error: New name already in use.')
8591 } else if (this.themes.hasOwnProperty(oldName)) { 8592 const th = this.copy(oldName, newName)
8593 this.remove(oldName)
8594 return th
Do not access Object.prototype method 'hasOwnProperty' from target object.
8615 if (targetName == 'Default') {
8616 throw new Error('jqplot.ThemeEngine Error: Cannot copy over Default theme')
8617 }
8618 if (!this.themes.hasOwnProperty(sourceName)) { 8619 var s = 'jqplot.ThemeEngine Error: Source name invalid'
8620 throw new Error(s)
8621 }
Do not access Object.prototype method 'hasOwnProperty' from target object.
8619 var s = 'jqplot.ThemeEngine Error: Source name invalid'
8620 throw new Error(s)
8621 }
8622 if (this.themes.hasOwnProperty(targetName)) { 8623 var s = 'jqplot.ThemeEngine Error: Target name invalid'
8624 throw new Error(s)
8625 } else {
Do not access Object.prototype method 'hasOwnProperty' from target object.
9808
9809 if (document && document.getElementsByTagName('html') && document.getElementsByTagName('html')[0].lang) {
9810 l = document.getElementsByTagName('html')[0].lang
9811 if (!jsDate.regional.hasOwnProperty(l)) { 9812 l = jsDate.config.defaultLocale
9813 }
9814 }
Do not access Object.prototype method 'hasOwnProperty' from target object.
9928 let loc = jsDate.regional.getLocale()
9929
9930 // check if syntax and locale are available or reversed
9931 if (syntax && jsDate.formats.hasOwnProperty(syntax)) { 9932 syn = syntax
9933 } else if (syntax && jsDate.regional.hasOwnProperty(syntax)) {
9934 loc = syntax
Do not access Object.prototype method 'hasOwnProperty' from target object.
9930 // check if syntax and locale are available or reversed
9931 if (syntax && jsDate.formats.hasOwnProperty(syntax)) {
9932 syn = syntax
9933 } else if (syntax && jsDate.regional.hasOwnProperty(syntax)) { 9934 loc = syntax
9935 }
9936
Do not access Object.prototype method 'hasOwnProperty' from target object.
9934 loc = syntax
9935 }
9936
9937 if (locale && jsDate.formats.hasOwnProperty(locale)) { 9938 syn = locale
9939 } else if (locale && jsDate.regional.hasOwnProperty(locale)) {
9940 loc = locale
Do not access Object.prototype method 'hasOwnProperty' from target object.
9936
9937 if (locale && jsDate.formats.hasOwnProperty(locale)) {
9938 syn = locale
9939 } else if (locale && jsDate.regional.hasOwnProperty(locale)) { 9940 loc = locale
9941 }
9942
Description
It is preferable to call certain Object.prototype
methods through Object
on object instances instead of using the builtins directly.
Objects can have properties that shadow the builtins on Object.prototype
, potentially causing unintended behavior or denial-of-service security vulnerabilities.
For example, it would be unsafe for a webserver to parse JSON input from a client and call hasOwnProperty
directly on the resulting object, because a malicious client could send a JSON value like {"hasOwnProperty": 1}
and cause the server to crash.
It's better to always call these methods from Object.prototype
. For example, obj.hasOwnProperty("bar")
should be replaced with Object.prototype.hasOwnProperty.call(obj, "bar")
.
Bad Practice
let hasBarProperty = obj.hasOwnProperty("property");
let isPrototypeOfBar = obj.isPrototypeOf(property);
let barIsEnumerable = obj.propertyIsEnumerable("property");
Recommended
let hasBarProperty = Object.prototype.hasOwnProperty.call(obj, "property");
let isPrototypeOfBar = Object.prototype.isPrototypeOf.call(obj, property);
let barIsEnumerable = {}.propertyIsEnumerable.call(obj, "property");