Skip to content

Commit

Permalink
Fix get()
Browse files Browse the repository at this point in the history
  • Loading branch information
ehmicky committed Mar 13, 2022
1 parent 901dabc commit f576342
Showing 1 changed file with 7 additions and 2 deletions.
9 changes: 7 additions & 2 deletions src/config/normalize/lib/wild_wild_path/get.js
Original file line number Diff line number Diff line change
Expand Up @@ -10,8 +10,13 @@ export const list = function (target, queryOrPath) {
// Retrieve a single property's value in `target` matching a query string.
// Wildcards can be used, but only the first value is returned.
export const get = function (target, queryOrPath) {
const entry = iterate(target, queryOrPath).find(isExisting)
return entry === undefined ? undefined : entry.value
// eslint-disable-next-line fp/no-loops
for (const { value, missing } of iterate(target, queryOrPath)) {
// eslint-disable-next-line max-depth
if (!missing) {
return value
}
}
}

// Check if a property is not missing according to a query
Expand Down

0 comments on commit f576342

Please sign in to comment.