Refactor visualization into separate class

This commit is contained in:
Arne Schlüter 2015-02-08 10:44:10 +01:00
commit a2b6e437d4
4 changed files with 138 additions and 92 deletions

View file

@ -4,15 +4,15 @@ export default {
* Returns only the incidents which fall into the given categories
* @param {Array[Object]} data The incidents to filter
* @param {Array[String]} categories
* @return {Arreay[Obect]}
* @return {Array[Obect]}
*/
categories: function (data, categories) {
return response.filter(function (incident) {
return data.filter(function (incident) {
for (var i = 0, l = incident.categories.length; i < l; i++)
if (categories.indexOf(incident.categories[i]) !== -1)
return true;
return true
return false;
return false
});
}