All files / src/helpers/json getSourcesFromJSON.js

100% Statements 9/9
75% Branches 3/4
100% Functions 2/2
100% Lines 9/9

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      2x 10000x   10000x 20000x 20000x 20000x 20000x 15000x         10000x      
import getJSONContent from "./getJSONContent.js"
 
export default (list, keys) => {
  return list.map((jsonObject) => {
    let source = {}
 
    for (const key in keys) {
      Eif (Object.prototype.hasOwnProperty.call(keys, key)) {
        const selector = keys[key]
        const content = getJSONContent(jsonObject, selector)
        if (content) {
          source[key] = content
        }
      }
    }
 
    return source
  })
}