Skip to content

Commit 851f928

Browse files
authored
return key value when key value is undefined
return `fromObject[key]` if undefined since there is no point going any further
1 parent cdf98d3 commit 851f928

1 file changed

Lines changed: 2 additions & 2 deletions

File tree

src/get-key-value.js

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -78,7 +78,7 @@ function _getValue(fromObject, key, keys) {
7878

7979
if (keys.length === 0) {
8080
if (isValueArray) {
81-
if (typeof arrayIndex === 'undefined') {
81+
if (typeof arrayIndex === 'undefined' || fromObject[key] === undefined) {
8282
result = fromObject[key];
8383
} else {
8484
result = fromObject[key][arrayIndex];
@@ -141,4 +141,4 @@ function _getValue(fromObject, key, keys) {
141141
}
142142

143143
return result;
144-
}
144+
}

0 commit comments

Comments
 (0)