Skip to content

Commit

Permalink
fix: rename isObject to isPlainObject, close #104
Browse files Browse the repository at this point in the history
  • Loading branch information
pengzhanbo committed Dec 7, 2024
1 parent 66733f4 commit 9ee63e8
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 4 deletions.
4 changes: 2 additions & 2 deletions plugin/src/core/transform.ts
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ import {
isArray,
isEmptyObject,
isFunction,
isObject,
isPlainObject,
sortBy,
toArray,
} from '@pengzhanbo/utils'
Expand Down Expand Up @@ -52,7 +52,7 @@ export function transformMockData(
const mocks: Record<string, MockOptions> = {}

list
.filter(mock => isObject(mock) && mock.enabled !== false && mock.url)
.filter(mock => isPlainObject(mock) && mock.enabled !== false && mock.url)
.forEach((mock) => {
const { pathname, query } = urlParse(mock.url)
const list = (mocks[pathname!] ??= [])
Expand Down
4 changes: 2 additions & 2 deletions plugin/src/core/validator.ts
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
import type { ExtraRequest } from '../types'
import { isArray, isObject } from '@pengzhanbo/utils'
import { isArray, isPlainObject } from '@pengzhanbo/utils'

export function validate(
request: ExtraRequest,
Expand Down Expand Up @@ -50,7 +50,7 @@ function isIncluded(source: unknown, target: unknown): boolean {
}),
)
}
if (isObject(source) && isObject(target))
if (isPlainObject(source) && isPlainObject(target))
return isObjectSubset(source, target)

// 相比于 === , 该方法能够正确的处理 NaN、 0、 +0、 -0 等特殊情况
Expand Down

0 comments on commit 9ee63e8

Please sign in to comment.