@flourish/filter
Advanced tools
Comparing version 0.0.2 to 0.0.3
@@ -44,9 +44,10 @@ (function (global, factory) { | ||
var filter_list_obj = {}; | ||
data.forEach(function(data_obj) { | ||
var filter_name = data_obj[filter_prop]; | ||
if (filter_name && !filter_list_obj[filter_name]) { | ||
var n = data.length; | ||
for (var i=0; i<n; i++) { | ||
var filter_name = data[i][filter_prop]; | ||
if (!filter_list_obj[filter_name]) { | ||
filter_list_obj[filter_name] = true; | ||
filter_list.push(filter_name); | ||
} | ||
}); | ||
} | ||
return filter_list; | ||
@@ -56,3 +57,3 @@ } | ||
function createFilterTree(data, filter_props) { | ||
function createFilter(data, filter_props) { | ||
if (!Array.isArray(data)) return; | ||
@@ -186,3 +187,3 @@ | ||
exports.getFilterList = getFilterList; | ||
exports.createFilterTree = createFilterTree; | ||
exports.createFilter = createFilter; | ||
@@ -189,0 +190,0 @@ Object.defineProperty(exports, '__esModule', { value: true }); |
{ | ||
"name": "@flourish/filter", | ||
"version": "0.0.2", | ||
"version": "0.0.3", | ||
"description": "Reusable filter and optional aggregator", | ||
@@ -5,0 +5,0 @@ "main": "filter.js", |
@@ -8,9 +8,10 @@ import { aggregators } from "./aggregators"; | ||
var filter_list_obj = {}; | ||
data.forEach(function(data_obj) { | ||
var filter_name = data_obj[filter_prop]; | ||
if (filter_name && !filter_list_obj[filter_name]) { | ||
var n = data.length; | ||
for (var i=0; i<n; i++) { | ||
var filter_name = data[i][filter_prop]; | ||
if (!filter_list_obj[filter_name]) { | ||
filter_list_obj[filter_name] = true; | ||
filter_list.push(filter_name); | ||
} | ||
}); | ||
} | ||
return filter_list; | ||
@@ -20,3 +21,3 @@ } | ||
function createFilterTree(data, filter_props) { | ||
function createFilter(data, filter_props) { | ||
if (!Array.isArray(data)) return; | ||
@@ -150,2 +151,2 @@ | ||
export { getFilterList, createFilterTree }; | ||
export { getFilterList, createFilter }; |
356
1511106