From c5340e95040a9394fe568e96dd5b1961c168b467 Mon Sep 17 00:00:00 2001 From: Adrien Foulon <6115458+Tofandel@users.noreply.github.com> Date: Thu, 15 Aug 2024 11:16:35 +0200 Subject: [PATCH] Use in check --- src/index.ts | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/index.ts b/src/index.ts index 8c0423f..f79f5d6 100644 --- a/src/index.ts +++ b/src/index.ts @@ -237,7 +237,7 @@ function getByPath & string>( if ( typeof current !== 'object' || current === null || - !current.hasOwnProperty(pathPart) + !(pathPart in current) ) { return undefined } @@ -282,7 +282,7 @@ function setByPath< if ( typeof current !== 'object' || current === null || - !current.hasOwnProperty(pathPart) + !(pathPart in current) ) { throwAssignmentError(current, pathPart) }