All files / latest/src/handlers/basic stringify.js

100% Statements 14/14
100% Branches 4/4
100% Functions 1/1
100% Lines 14/14

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 151x 1x 1x 1x 1x 1x 1x 300x 8x 8x 292x 292x 1x 1x  
/**
 * Stringifies input value if it is an object
 * @param {any} value - any value
 * @returns {string} returns stringified input value for object,
 * or input value if input was not an onbject
 */
const stringify = (value) => {
  if (value && typeof value === 'object') {
    return JSON.stringify(value);
  }
  return value;
};
 
module.exports = stringify;