Skip to content

Commit

Permalink
Use is-plain-obj
Browse files Browse the repository at this point in the history
  • Loading branch information
ehmicky committed May 29, 2022
1 parent 18b63c7 commit 650c003
Showing 1 changed file with 4 additions and 6 deletions.
10 changes: 4 additions & 6 deletions src/config/normalize/lib/keywords/list/transform.js
Original file line number Diff line number Diff line change
@@ -1,3 +1,5 @@
import isPlainObj from 'is-plain-obj'

const main = function (definition, input) {
const { value, newProp } = isTransformMove(definition)
? definition
Expand All @@ -15,10 +17,7 @@ const main = function (definition, input) {
// of the property before being moved
const isTransformMove = function (definition) {
return (
typeof definition === 'object' &&
definition !== null &&
'value' in definition &&
'newProp' in definition
isPlainObj(definition) && 'value' in definition && 'newProp' in definition
)
}

Expand Down Expand Up @@ -46,8 +45,7 @@ const COMMON_MOVES = [
{
test(newInput, oldInput) {
return (
typeof newInput === 'object' &&
newInput !== null &&
isPlainObj(newInput) &&
Object.keys(newInput).length === 1 &&
newInput[Object.keys(newInput)[0]] === oldInput
)
Expand Down

0 comments on commit 650c003

Please sign in to comment.