import { canIUseConfig } from '@jolibox/common'; export function getCanIUseConfig(platform: 'h5' | 'native', key: string) { return canIUseConfig.config[platform]?.[key]; } export function get, P extends string | string[], Default = undefined>( obj: T, path: P, defaultValue?: Default ): unknown { const pathArray = Array.isArray(path) ? path : (path as string).replace(/\[(\d+)\]/g, '.$1').split('.'); let result: any = obj; for (const key of pathArray) { if (result && (typeof result === 'object' || Array.isArray(result))) { result = result[key]; } else { return defaultValue as any; } } return result === undefined ? defaultValue : result; }