From 03194e905ef282432a3526bf5a650d36ea68c6f0 Mon Sep 17 00:00:00 2001 From: Jean Jacques Warmerdam Date: Tue, 6 Feb 2024 20:51:28 +0100 Subject: [PATCH] fix: use `Object.hasOwnProperty` for additional browser support (#151) --- package.json | 5 ++++- src/index.ts | 4 ++-- 2 files changed, 6 insertions(+), 3 deletions(-) diff --git a/package.json b/package.json index 85d1630..98c314d 100644 --- a/package.json +++ b/package.json @@ -38,7 +38,10 @@ "eslintConfig": { "extends": [ "./node_modules/kcd-scripts/eslint.js" - ] + ], + "rules": { + "prefer-object-has-own": "off" + } }, "eslintIgnore": [ "node_modules", diff --git a/src/index.ts b/src/index.ts index 1989088..7972c0e 100644 --- a/src/index.ts +++ b/src/index.ts @@ -368,7 +368,7 @@ function getItemValues( 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 @@ -412,7 +412,7 @@ function getNestedValues( 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)