@capawesome/cli
Version:
The Capawesome Cloud Command Line Interface (CLI) to manage Live Updates and more.
23 lines (22 loc) • 697 B
JavaScript
export const parseCustomProperties = (customProperty) => {
if (!customProperty) {
return undefined;
}
const customProperties = {};
for (const property of customProperty) {
if (!property) {
continue;
}
const separatorIndex = property.indexOf('=');
if (separatorIndex === -1) {
continue;
}
const key = property.slice(0, separatorIndex).trim();
const value = property.slice(separatorIndex + 1).trim();
if (!key || !value) {
continue;
}
customProperties[key] = value;
}
return Object.keys(customProperties).length > 0 ? customProperties : undefined;
};