MCPcopy Index your code
hub / github.com/GoogleTrends/data / filterData

Function filterData

tableload.js:171–194  ·  view source on GitHub ↗
()

Source from the content-addressed store, hash-verified

169 }
170
171 function filterData() {
172 console.log(filters);
173 currentData = data.filter(function(d) {
174 var keep = true;
175 Object.keys(filters).some(function(k) {
176 if (["coverage", "subject"].indexOf(k) >=0) {
177 if (d[k]
178 .split(",")
179 .map(function(a) {return a.trim()})
180 .indexOf(filters[k]) < 0) {return (keep = false);}
181 }
182 if (k === "from" && d.date < filters.from) {
183 return (keep = false);
184 }
185 if (k === "to" && d.date > filters.to) {
186 return (keep = false);
187 }
188 });
189 return keep;
190 })
191 maxPages = Math.ceil(currentData.length / pagination);
192 page = Math.min(page, maxPages);
193 showData();
194 }
195
196 function showData() {
197 console.log(currentData);

Callers 2

loadDataFunction · 0.85
initFiltersFunction · 0.85

Calls 1

showDataFunction · 0.85

Tested by

no test coverage detected

Used in the wild real call sites across dependent graphs

searching dependent graphs…