Thanks to visit codestin.com
Credit goes to github.com

Skip to content

Commit 2607a75

Browse files
author
knight.chen
committed
fix(utils): 修复 isNil 方法逻辑错误 KNXCloud#41
1 parent 60ddbc8 commit 2607a75

File tree

3 files changed

+4
-5
lines changed

3 files changed

+4
-5
lines changed

packages/utils/src/check.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@ export type ESModule = {
44
};
55

66
export function isNil<T>(val: T | null | undefined): val is null | undefined {
7-
return val === null && val === undefined;
7+
return val === null || val === undefined;
88
}
99

1010
export function isObject(val: unknown): val is Record<string, unknown> {
Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
export function isNil<T = unknown>(val: T): val is NonNullable<T> {
2-
return val !== null && val !== undefined;
2+
return val === null || val === undefined;
33
}
44

55
export function isObject(el: unknown): el is Record<string | number | symbol, unknown> {
6-
return isNil(el) && typeof el === 'object';
6+
return !isNil(el) && typeof el === 'object';
77
}

packages/vue-simulator-renderer/src/utils/comp-node.ts

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,7 @@
11
import type { ComponentInternalInstance, VNode } from 'vue';
22
import type { ComponentInstance } from '../interface';
3-
import { isNil } from '@knxcloud/lowcode-utils';
43
import { isProxy } from 'vue';
5-
import { isObject } from './check';
4+
import { isObject, isNil } from './check';
65

76
const SYMBOL_VDID = Symbol('_LCDocId');
87
const SYMBOL_VNID = Symbol('_LCNodeId');

0 commit comments

Comments
 (0)