Skip to content

Commit

Permalink
Refactoring
Browse files Browse the repository at this point in the history
  • Loading branch information
ehmicky committed Mar 13, 2022
1 parent b86b952 commit 0371b9b
Showing 1 changed file with 6 additions and 2 deletions.
8 changes: 6 additions & 2 deletions src/config/normalize/lib/wild_wild_path/iterate/main.js
Original file line number Diff line number Diff line change
Expand Up @@ -14,14 +14,18 @@ import { expandRecursiveTokens } from './recurse.js'
export const iterate = function* (target, query, opts) {
const optsA = getOptions(opts)
const parents = new Set([])
const entries = getRootEntries(target, query)
yield* iterateLevel({ entries, index: 0, parents, opts: optsA })
}

const getRootEntries = function (target, query) {
const queryArrays = parseQuery(query)
const entries = queryArrays.map((queryArray) => ({
return queryArrays.map((queryArray) => ({
queryArray,
value: target,
path: [],
missing: false,
}))
yield* iterateLevel({ entries, index: 0, parents, opts: optsA })
}

// `parents` is used to prevent infinite recursions when using ** together with
Expand Down

0 comments on commit 0371b9b

Please sign in to comment.