import _ from 'lodash-es';
/**
 * stringToProps
 *
 * @export
 * @param {*} stringProperties
 * @return {*}
 */
export function stringToProps(stringProperties) {
    if (!stringProperties) {
        throw new Error('No properties found');
    }
    let configObject = {};
    try {
        // Parse the JSON string into an array of objects
        const configArray = JSON.parse(stringProperties);
        configObject = _.fromPairs(configArray.map((item) => {
            // Normalize the key to camelCase, regardless of its original casing
            const key = _.camelCase(item.key || item.Key);
            const value = _.has(item, 'Value') ? item.Value : item.value || '';
            return [key, value];
        }));
    }
    catch (error) {
        return { error: error.message };
    }
    return { attributes: configObject };
}
//# sourceMappingURL=stringUtils.js.map