zgg-ui
Version:
2.0.1 正式版本 基于 Vue 3、UniApp 和 TypeScript 开发的多端适配移动端 UI 组件库,旨在提供丰富的组件集合,帮助开发者快速构建多端响应式的移动应用界面
23 lines (17 loc) • 557 B
text/typescript
import { isPrototype } from './_isPrototype'
import { isObject } from './is-object'
function overArg(func: any, transform: any) {
return function (arg: any) {
return func(transform(arg))
}
}
const getPrototype = overArg(Object.getPrototypeOf, Object)
function baseCreate(proto: any) {
return isObject(proto) ? objectCreate(proto) : {}
}
const objectCreate = Object.create
export function initCloneObject(object: any) {
return typeof object.constructor == 'function' && !isPrototype(object)
? baseCreate(getPrototype(object))
: {}
}