|
|
|
@ -1,13 +1,5 @@
|
|
|
|
|
var type_mapping = require( '../helper/type_mapping' ); |
|
|
|
|
|
|
|
|
|
/** |
|
|
|
|
* Calculate the set-style intersection of two arrays |
|
|
|
|
*/ |
|
|
|
|
var intersection = function intersection(set1, set2) { |
|
|
|
|
return set2.filter(function(value) { |
|
|
|
|
return set1.indexOf(value) !== -1; |
|
|
|
|
}); |
|
|
|
|
}; |
|
|
|
|
var _ = require('lodash'); |
|
|
|
|
|
|
|
|
|
/** |
|
|
|
|
* Combine all types and determine the unique subset |
|
|
|
@ -27,11 +19,11 @@ module.exports = function calculate_types(clean_types) {
|
|
|
|
|
var types = type_mapping.types; |
|
|
|
|
|
|
|
|
|
if (clean_types.from_layers) { |
|
|
|
|
types = intersection(types, clean_types.from_layers); |
|
|
|
|
types = _.intersection(types, clean_types.from_layers); |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
if (clean_types.from_sources) { |
|
|
|
|
types = intersection(types, clean_types.from_sources); |
|
|
|
|
types = _.intersection(types, clean_types.from_sources); |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
return types; |
|
|
|
|