class Wutil {
/**
* 数组转对象
* key1 对象key值
* key2 对象key值
* data 数组
* @example:
* let path = this.arrayToObj("x", "y", [10, 50, 50, 50, 30, 100]);
*/
arrayToObj(key1, key2, data) {
let list = [];
data.map((item, index) => {
let first = index + index;
if (first < data.length) {
list.push({
[key1]: data[first],
[key2]: data[first + 1],
});
}
});
console.log(list);
return list;
}
}