v-connection
Version:
Sofie TV Automation Vizrt Media Sequencer Engine connection library
24 lines • 913 B
JavaScript
;
Object.defineProperty(exports, "__esModule", { value: true });
exports.has = exports.wrapInBracesIfNeeded = void 0;
function wrapInBracesIfNeeded(value) {
// UUID/GUID regex pattern
const uuidPattern = /^[0-9a-f]{8}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{12}$/i;
// If it's already wrapped in braces, return as is
if (value.startsWith('{') && value.endsWith('}')) {
return value;
}
// Remove braces if present to check the raw value
const rawValue = value.replace(/[{}]/g, '');
// Only wrap in braces if it matches UUID pattern
if (uuidPattern.test(rawValue)) {
return `{${rawValue}}`;
}
return value;
}
exports.wrapInBracesIfNeeded = wrapInBracesIfNeeded;
function has(object, property) {
return Object.prototype.hasOwnProperty.call(object, property);
}
exports.has = has;
//# sourceMappingURL=util.js.map