Skip to content

Commit

Permalink
fix: use Object.hasOwnProperty for additional browser support (#151)
Browse files Browse the repository at this point in the history
  • Loading branch information
sjaq authored Feb 6, 2024
1 parent 901882d commit 03194e9
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 3 deletions.
5 changes: 4 additions & 1 deletion package.json
Original file line number Diff line number Diff line change
Expand Up @@ -38,7 +38,10 @@
"eslintConfig": {
"extends": [
"./node_modules/kcd-scripts/eslint.js"
]
],
"rules": {
"prefer-object-has-own": "off"
}
},
"eslintIgnore": [
"node_modules",
Expand Down
4 changes: 2 additions & 2 deletions src/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -368,7 +368,7 @@ function getItemValues<ItemType>(
value = key(item)
} else if (item == null) {
value = null
} else if (Object.hasOwn(item, key)) {
} else if (Object.hasOwnProperty.call(item, key)) {
value = (item as IndexableByString)[key]
} else if (key.includes('.')) {
// eslint-disable-next-line @typescript-eslint/no-unsafe-call
Expand Down Expand Up @@ -412,7 +412,7 @@ function getNestedValues<ItemType>(

if (nestedItem == null) continue

if (Object.hasOwn(nestedItem as object, nestedKey)) {
if (Object.hasOwnProperty.call(nestedItem, nestedKey)) {
const nestedValue = (nestedItem as IndexableByString)[nestedKey]
if (nestedValue != null) {
nestedValues.push(nestedValue as IndexableByString | string)
Expand Down

0 comments on commit 03194e9

Please sign in to comment.