import { PropType, ComponentPublicInstance } from 'vue'; export function noop() {} export const inBrowser = typeof window !== 'undefined'; // unknown type for Vue prop export const UnknownProp = (null as unknown) as PropType; // eslint-disable-next-line export type ComponentInstance = ComponentPublicInstance<{}, any>; export function get(object: any, path: string): any { const keys = path.split('.'); let result = object; keys.forEach((key) => { result = result[key] ?? ''; }); return result; } export type Writeable = { -readonly [P in keyof T]: T[P] }; export function pick( obj: T, keys: ReadonlyArray, ignoreUndefined?: boolean ) { return keys.reduce((ret, key) => { if (!ignoreUndefined || obj[key] !== undefined) { ret[key] = obj[key]; } return ret; }, {} as Writeable>); }