Skip to content

Commit

Permalink
[INTERNAL] lib/processors/jsdoc: Prefer Object.hasOwn over Object.pro…
Browse files Browse the repository at this point in the history
…totype.hasOwnProperty.call

Cherry picked from SAP/openui5@7e59f5702
  • Loading branch information
codeworrior committed Jul 18, 2023
1 parent 004346d commit 14388b8
Showing 1 changed file with 3 additions and 6 deletions.
9 changes: 3 additions & 6 deletions lib/processors/jsdoc/lib/ui5/template/publish.cjs
Original file line number Diff line number Diff line change
Expand Up @@ -85,9 +85,6 @@ let __symbols;
let __longnames;
let __missingLongnames = {};

/* shortcut for Object.prototype.hasOwnProperty.call(obj, prop) */
const hasOwn = Function.prototype.call.bind(Object.prototype.hasOwnProperty);

function merge(target, source) {
if ( source != null ) {
// simple single source merge
Expand All @@ -108,7 +105,7 @@ function merge(target, source) {
}

function lookup(key) {
if ( !Object.prototype.hasOwnProperty.call(__longnames, key) ) {
if ( !Object.hasOwn(__longnames, key) ) {
__missingLongnames[key] = (__missingLongnames[key] || 0) + 1;
__longnames[key] = __symbols.find((symbol) => symbol.longname === key);
}
Expand Down Expand Up @@ -2802,7 +2799,7 @@ function validateAPIJSON(api) {
}
});
}
if ( Object.prototype.hasOwnProperty.call(symbol, "constructor") ) {
if ( Object.hasOwn(symbol, "constructor") ) {
checkMethodSignature(symbol.constructor, symbol.name + ".constructor");
}
if ( symbol.properties ) {
Expand Down Expand Up @@ -2850,7 +2847,7 @@ function validateAPIJSON(api) {

Object.keys(missing).forEach((type) => {
if ( Array.isArray(missing[type]) ) {
if ( hasOwn(erroneousTypes, type.toLowerCase()) ) {
if ( Object.hasOwn(erroneousTypes, type.toLowerCase()) ) {
error(`type '${type}' (use '${erroneousTypes[type.toLowerCase()]}' instead)`);
missing[type].forEach((usage) => error(` ${usage}`));
} else {
Expand Down

0 comments on commit 14388b8

Please sign in to comment.