var arrProps = ["GROUP_PROPS"];
var groups = ["Тест1", "Тест2", "Тест3"];
arrProps.push(groups);
array(
[GROUP_PROPS] => array("Тест1", "Тест2", "Тест3"),
);
all = [...document.querySelectorAll('.prop-column div')].filter(div => !div.matches('.hide, .call, .prop-value'))
obj = {}
current = ''
all.forEach(div => {
try {
if(div.matches('.delimiter')) {
obj[div.textContent] = []
current = div.textContent
} else {
obj[current].push({
[div.querySelector('.call').textContent] : div.querySelector('.prop-value').textContent
})
}
} catch {}
})
console.log(obj)
const arr = ['some'];
const props = ['something', 'more', '...'];
function createObjectFromArray(array) {
let obj = {};
array.map(itm => obj[itm] = itm);
return obj;
}
function transformArrayToObject(arr, elementIndex, value) {
if(!arr || isNaN(elementIndex) || !value) return {};
const objectFromArr = createObjectFromArray(arr);
objectFromArr[arr[elementIndex]] = value;
return objectFromArr;
}
console.log(transformArrayToObject(arr, 0, props));