spec/helper.js
function normalize(obj) {
  if (obj === null || typeof obj !== 'object') {
    return JSON.stringify(obj);
  }
  if (obj instanceof Array) {
    return '[' + obj.map(normalize).join(', ') + ']';
  }
  var answer = '{';
  for (var key of Object.keys(obj).sort()) {
    answer += key + ': ';
    answer += normalize(obj[key]);
    answer += ', ';
  }
  answer += '}';
  return answer;
}
function normalize(obj) {
  if (obj === null || typeof obj !== 'object') {
    return JSON.stringify(obj);
  }
  if (obj instanceof Array) {
    return '[' + obj.map(normalize).join(', ') + ']';
  }
  var answer = '{';
  for (var key of Object.keys(obj).sort()) {
    answer += key + ': ';
    answer += normalize(obj[key]);
    answer += ', ';
  }
  answer += '}';
  return answer;
}
function normalize ( obj ) { if ( obj === null || typeof obj !== 'object' ) { return JSON . stringify ( obj ) ; } if ( obj instanceof Array ) { return '[' + obj . map ( normalize ) . join ( ', ' ) + ']' ; } var answer = '{' ; for ( var key of Object . keys ( obj ) . sort ( ) ) { answer += key + ': ' ; answer += normalize ( obj [ key ] ) ; answer += ', ' ; } answer += '}' ; return answer ; }
Normalizes a JSON object.
Normalizes a JSON object .