UNPKG

@lobehub/ui

Version:

Lobe UI is an open-source UI component library for building AIGC web apps

22 lines 775 B
import { KeyMapEnum } from "./type"; export var splitKeysByPlus = function splitKeysByPlus(keys) { return keys.replaceAll('++', "+".concat(KeyMapEnum.Equal)).split('+'); }; export var startCase = function startCase(str) { return str.replaceAll(/([A-Z])/g, ' $1').replace(/^./, function (s) { return s.toUpperCase(); }).trim(); }; export var checkIsAppleDevice = function checkIsAppleDevice(isApple) { if (isApple !== undefined) { return isApple; } if (typeof window === 'undefined' || typeof navigator === 'undefined') { return false; // 处理 SSR 环境 } var userAgent = navigator.userAgent.toLowerCase(); return /mac|iphone|ipod|ipad|ios/i.test(userAgent); }; export var combineKeys = function combineKeys(keys) { return keys.join('+'); };