@dark-engine/platform-desktop
Version:
Dark renderer to desktop platforms like Windows, Linux, macOS via Nodegui and Qt
46 lines (45 loc) • 1.35 kB
JavaScript
;
Object.defineProperty(exports, '__esModule', { value: true });
exports.illegal =
exports.detectIsContainer =
exports.throwUnsupported =
exports.detectisValidURL =
exports.createSetterName =
exports.capitalize =
void 0;
const core_1 = require('@dark-engine/core');
const constants_1 = require('../constants');
function capitalize(value) {
return value.charAt(0).toUpperCase() + value.substring(1);
}
exports.capitalize = capitalize;
function createSetterName(value) {
return `set${capitalize(value)}`;
}
exports.createSetterName = createSetterName;
function detectisValidURL(value) {
try {
const url = new URL(value);
return url.protocol.startsWith('http');
} catch (error) {
return false;
}
}
exports.detectisValidURL = detectisValidURL;
function throwUnsupported(value) {
console.warn(`Unsupported action in ${value.constructor.name}`);
}
exports.throwUnsupported = throwUnsupported;
function detectIsContainer(element) {
const container = element;
return (
element &&
(0, core_1.detectIsObject)(element) &&
(0, core_1.detectIsFunction)(container.detectIsContainer) &&
container.detectIsContainer()
);
}
exports.detectIsContainer = detectIsContainer;
const illegal = x => (0, core_1.illegal)(x, constants_1.LIB);
exports.illegal = illegal;
//# sourceMappingURL=utils.js.map