Skip to content

Commit 21673ec

Browse files
authored
refactor(debugger): don't use Object.hasOwn (#6960)
It's more performant to access the property than to use `Object.hasOwn`.
1 parent 68516f7 commit 21673ec

File tree

1 file changed

+4
-4
lines changed
  • packages/dd-trace/src/debugger/devtools_client/snapshot

1 file changed

+4
-4
lines changed

packages/dd-trace/src/debugger/devtools_client/snapshot/processor.js

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -38,7 +38,7 @@ function getPropertyValue (prop, maxLength) {
3838

3939
function getPropertyValueRaw (prop, maxLength) {
4040
// Special case for getters and setters which does not have a value property
41-
if (Object.hasOwn(prop, 'get')) {
41+
if (prop.get) {
4242
const hasGet = prop.get.type !== 'undefined'
4343
const hasSet = prop.set.type !== 'undefined'
4444
if (hasGet) {
@@ -162,7 +162,7 @@ function toObject (type, props, maxLength, timeBudgetReached) {
162162
fields: processProperties(props, maxLength)
163163
}
164164

165-
if (Object.hasOwn(props, fieldCountSym)) {
165+
if (props[fieldCountSym] !== undefined) {
166166
result.notCapturedReason = 'fieldCount'
167167
result.size = props[fieldCountSym]
168168
}
@@ -283,11 +283,11 @@ function shouldRedactMapValue (key) {
283283
}
284284

285285
function getNormalizedNameFromProp (prop) {
286-
return normalizeName(prop.name, Object.hasOwn(prop, 'symbol'))
286+
return normalizeName(prop.name, prop.symbol !== undefined)
287287
}
288288

289289
function setNotCaptureReasonOnCollection (result, collection) {
290-
if (Object.hasOwn(collection, collectionSizeSym)) {
290+
if (collection[collectionSizeSym] !== undefined) {
291291
result.notCapturedReason = 'collectionSize'
292292
result.size = collection[collectionSizeSym]
293293
}

0 commit comments

Comments
 (0)