Skip to content
Open
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
7 changes: 2 additions & 5 deletions src/object/get.ts
Original file line number Diff line number Diff line change
Expand Up @@ -23,10 +23,7 @@ export function get<TDefault = unknown>(
const segments = path.split(/[\.\[\]]/g)
let current: any = value
for (const key of segments) {
if (current === null) {
return defaultValue as TDefault
}
if (current === undefined) {
if (current === undefined || current === null) {
Comment thread
OgabekYuldoshev marked this conversation as resolved.
Outdated
return defaultValue as TDefault
}
const unquotedKey = key.replace(/['"]/g, '')
Expand All @@ -35,7 +32,7 @@ export function get<TDefault = unknown>(
}
current = current[unquotedKey]
}
if (current === undefined) {
if (current === undefined || current === null) {
return defaultValue as TDefault
}
return current
Expand Down
Loading