All files validJson.js

100% Statements 5/5
50% Branches 1/2
100% Functions 1/1
100% Lines 4/4

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 81x 2x 2x   1x      
export const validJson = value => {
  try {
    Eif (typeof value === 'string') JSON.parse(value)
  } catch (e) {
    return `JSON needs to be valid: ${e.message}`
  }
}