Skip to content

Commit 83858f6

Browse files
cmtlythahaXiaoxin
authored andcommitted
feat: 补充schema工具 (#26)
* feat: 新增schema工具 * fix: 修复了getObjectType中对properties的错误判断 (#29) * fix: 修复了getObjectType中对properties的错误判断 * feat: 抽离了isObject方法 * feat: 通过Object.keys遍历替代forin,防止遍历到原型链上的键 --------- Co-authored-by: cmtlyt <cmtlyt@163.com> Co-authored-by: xiaoxin <130760663+hahaXiaoxin@users.noreply.github.com>
1 parent 9fad2f6 commit 83858f6

File tree

2 files changed

+5
-0
lines changed

2 files changed

+5
-0
lines changed

src/utils/index.ts

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -20,6 +20,7 @@ export * from './consola';
2020
export * from './get-info';
2121
export * from './jiti-import';
2222
export * from './loader';
23+
export * from './object';
2324
export * from './parse';
2425

2526
/**

src/utils/object.ts

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,4 @@
1+
/** 判断是否是对象 */
2+
export function isObject(value: any): value is object {
3+
return typeof value === 'object' && value !== null;
4+
}

0 commit comments

Comments
 (0)