PageSourceSearch

https://pressthink.org/j/rosen-archive/frontend/utils/timelineData.js?v=3.8.36

js pressthink.org collected 2026-10-02 04:27:26 UTC 996 bytes, 35 lines download raw bytes

1export function buildTimelineModel(records = []) {
2  const counts = new Map();
3  let dataMinYear = null;
4  let dataMaxYear = null;
5
6  for (const record of Array.isArray(records) ? records : []) {
7    const year = Number.parseInt(record?.year, 10);
8    if (!Number.isFinite(year)) continue;
9
10    const key = String(year);
11    counts.set(key, (counts.get(key) || 0) + 1);
12    dataMinYear = dataMinYear === null ? year : Math.min(dataMinYear, year);
13    dataMaxYear = dataMaxYear === null ? year : Math.max(dataMaxYear, year);
14  }
15
16  if (dataMinYear === null || dataMaxYear === null) {
17    return {
18      timelineData: [],
19      dataMinYear: null,
20      dataMaxYear: null,
21    };
22  }
23
24  const timelineData = [];
25  for (let year = dataMinYear - 1; year <= dataMaxYear + 1; year += 1) {
26    const key = String(year);
27    timelineData.push({ year: key, count: counts.get(key) || 0 });
28  }
29
30  return {
31    timelineData,
32    dataMinYear: String(dataMinYear),
33    dataMaxYear: String(dataMaxYear),
34  };
35}

Line numbers count LF bytes from the start of the resource, as the search results do. Vendor segments are library code the classifier recognised; they are stored but not indexed. Bytes are shown as Latin1 characters, one per byte.