Skip to content

Commit

Permalink
Refactoring
Browse files Browse the repository at this point in the history
  • Loading branch information
ehmicky committed Mar 6, 2022
1 parent 0302733 commit 0be42b4
Show file tree
Hide file tree
Showing 3 changed files with 5 additions and 3 deletions.
2 changes: 1 addition & 1 deletion src/config/normalize/lib/star_dot_path/entries/main.js
Original file line number Diff line number Diff line change
Expand Up @@ -50,7 +50,7 @@ const getAnyEntries = function (value, path) {

// For queries which do not use *, e.g. `a.b` or `a.1`
const getKeyEntries = function (value, path, token) {
return isObject(value) || Array.isArray(value)
return Array.isArray(value) || isObject(value)
? [{ value: value[token], path: [...path, token] }]
: []
}
Expand Down
4 changes: 3 additions & 1 deletion src/config/normalize/lib/star_dot_path/entries/recurse.js
Original file line number Diff line number Diff line change
@@ -1,6 +1,8 @@
import isPlainObj from 'is-plain-obj'

// Whether a property is considered an object that be recursed over
// Whether a property is considered an object that can:
// - Be recursed over
// This must return `false` for arrays.
export const isObject = function (value) {
return isPlainObj(value)
}
2 changes: 1 addition & 1 deletion src/config/normalize/lib/star_dot_path/set.js
Original file line number Diff line number Diff line change
Expand Up @@ -50,7 +50,7 @@ const setEntry = function (
}

const addDefaultTarget = function (target, key) {
if (isObject(target) || Array.isArray(target)) {
if (Array.isArray(target) || isObject(target)) {
return target
}

Expand Down

0 comments on commit 0be42b4

Please sign in to comment.