|
|
|
@ -76,11 +76,25 @@ var LAYER_ALIASES = {
|
|
|
|
|
|
|
|
|
|
var LAYER_WITH_ALIASES_TO_TYPE = extend({}, LAYER_ALIASES, LAYER_TO_TYPE); |
|
|
|
|
|
|
|
|
|
/** |
|
|
|
|
* 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 sourceAndLayerToType = function sourceAndLayerToType(source, layer) { |
|
|
|
|
return intersection(SOURCE_TO_TYPE[source], LAYER_WITH_ALIASES_TO_TYPE[layer]); |
|
|
|
|
}; |
|
|
|
|
|
|
|
|
|
module.exports = { |
|
|
|
|
types_list: ALL_TYPES, |
|
|
|
|
type_to_source: TYPE_TO_SOURCE, |
|
|
|
|
type_to_layer: TYPE_TO_LAYER, |
|
|
|
|
source_to_type: SOURCE_TO_TYPE, |
|
|
|
|
layer_to_type: LAYER_TO_TYPE, |
|
|
|
|
layer_with_aliases_to_type: LAYER_WITH_ALIASES_TO_TYPE |
|
|
|
|
layer_with_aliases_to_type: LAYER_WITH_ALIASES_TO_TYPE, |
|
|
|
|
source_and_layer_to_type: sourceAndLayerToType |
|
|
|
|
}; |
|
|
|
|