chore: add isFunction utils and improve isObject

This commit is contained in:
陈嘉涵
2020-01-19 20:13:50 +08:00
parent 3a4107ef49
commit 4b54ec6a18
11 changed files with 32 additions and 31 deletions
+2 -6
View File
@@ -1,4 +1,4 @@
import { isDef, isObj } from '.';
import { isDef, isObject } from '.';
import { ObjectIndex } from './types';
const { hasOwnProperty } = Object.prototype;
@@ -10,11 +10,7 @@ function assignKey(to: ObjectIndex, from: ObjectIndex, key: string) {
return;
}
if (
!hasOwnProperty.call(to, key) ||
!isObj(val) ||
typeof val === 'function'
) {
if (!hasOwnProperty.call(to, key) || !isObject(val)) {
to[key] = val;
} else {
// eslint-disable-next-line no-use-before-define