lib/icedfrisby.js
function _jsonParse(body) {
  let json = ''
  try {
    json = typeof body === 'object' ? body : JSON.parse(body)
  } catch (e) {
    throw new Error(
      'Error parsing JSON string: ' + e.message + '\n\tGiven: ' + body
    )
  }
  return json
}
function _jsonParse(body) {
  let json = ''
  try {
    json = typeof body === 'object' ? body : JSON.parse(body)
  } catch (e) {
    throw new Error(
      'Error parsing JSON string: ' + e.message + '\n\tGiven: ' + body
    )
  }
  return json
}
function _jsonParse ( body ) { let json = '' try { json = typeof body === 'object' ? body : JSON . parse ( body ) } catch ( e ) { throw new Error ( 'Error parsing JSON string: ' + e . message + '\n\tGiven: ' + body ) } return json }
Parse body as JSON, ensuring not to re-parse when body is already an object
(thanks @dcaylor).
@param {object} body - json object
@return {object}
@desc parse response body as json
Parse body as JSON ensuring not to re - parse when body is already an object ( thanks