All files / lib layers-metadata.js

100% Statements 8/8
100% Branches 1/1
100% Functions 3/3
100% Lines 8/8

Press n or j to go to the next uncovered block, b, p or k for the previous block.

1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20        3x   3x 2x   2x 2x     2x 1x     2x    
const {
  normalizeInputData,
  TableLayerMetadata,
  FeatureLayerMetadata
} = require('./helpers')
 
module.exports = function layersMetadata (data, options = {}) {
  const { layers: layersInput, tables: tablesInput } = normalizeInputData(data)
 
  const layers = layersInput.map((layer, i) => {
    return FeatureLayerMetadata.create(layer, { layerId: i, ...options })
  })
 
  const tables = tablesInput.map((table, i) => {
    return TableLayerMetadata.create(table, { layerId: layers.length + i, ...options })
  })
 
  return { layers, tables }
}