code: function sort(object) {
      if (sortArrays === true && Array.isArray(object)) {
        return object.sort();
      } else if (typeof object !== "object" || object === null) {
        return object;
      }
  
      return Object.keys(object).sort().map(function(key) {
        return {
          key: key,
          value: sort(object[key])
        };
      });
    }
docs: https://github.com/prettycode/Object.identical.js