Cannot read properties of null (reading 'addEventListener')
=>
Невозможно обратиться к свойству у null (обращение к 'addEventListener')
burger.addEventListener
null
const burger = document.querySelector('.burger');
querySelector
null
?const bounds: TRange = [32400, 54000];
// getSpaceRanges(bounds, [
// [35000, 37000],
// [36000, 54000],
// ])
const createItem = obj => ({ key: `${obj.name}-${obj.id}`, title: obj.name });
const result = Object.values(columnList.reduce((acc, n) => {
(acc[n.table.id] ??= {
...createItem(n.table),
children: [],
}).children.push(createItem(n));
return acc;
}, {}));
const combine = ({
entries = [],
createItem = entry => entry,
getParent = entry => entry,
getChild = entry => entry,
getKey = entry => entry.id
}) => {
const cache = new Map();
return entries.reduce((accumulator, entry) => {
const parent = getParent(entry);
const child = getChild(entry);
const key = getKey(parent);
if (!cache.has(key)) {
const branch = {
...createItem(parent),
children: []
};
cache.set(key, branch);
accumulator.push(branch);
}
cache.get(key).children.push(createItem(child));
return accumulator;
}, []);
};
const result = combine({
entries: columnList,
createItem: entry => ({
key: `${entry.name}-${entry.id}`,
title: entry.name
}),
getParent: entry => entry.table
});