import {get, set} from 'lodash-unified' import type {Entries} from 'type-fest' import type {Arrayable} from './typescript' export const keysOf = (arr: T) => Object.keys(arr) as Array // 效果等同于 Object.keys 不清楚为啥这样写 export const entriesOf = (arr: T) => Object.entries(arr) as Entries export {hasOwn} from '@vue/shared' // 检查一个值是否为对象自身的属性 /*export const getProp = ( obj: Record, path: Arrayable, defaultValue?: any ): { value: T } => { return { get value() { return get(obj, path, defaultValue) // 当get值为undefined 会以 defaultValue 取代。 }, set value(val: any) { set(obj, path, val) // 当path不存在,则创建用val替代 }, } }*/