UNPKG

@dark-engine/platform-desktop

Version:

Dark renderer to desktop platforms like Windows, Linux, macOS via Nodegui and Qt

29 lines (28 loc) 943 B
import { detectIsObject, detectIsFunction, illegal as $illegal } from '@dark-engine/core'; import { LIB } from '../constants'; function capitalize(value) { return value.charAt(0).toUpperCase() + value.substring(1); } function createSetterName(value) { return `set${capitalize(value)}`; } function detectisValidURL(value) { try { const url = new URL(value); return url.protocol.startsWith('http'); } catch (error) { return false; } } function throwUnsupported(value) { console.warn(`Unsupported action in ${value.constructor.name}`); } function detectIsContainer(element) { const container = element; return ( element && detectIsObject(element) && detectIsFunction(container.detectIsContainer) && container.detectIsContainer() ); } const illegal = x => $illegal(x, LIB); export { capitalize, createSetterName, detectisValidURL, throwUnsupported, detectIsContainer, illegal }; //# sourceMappingURL=utils.js.map