lib/index.js
function sortObject(originalSrc, options, done) {
  var callback

  if (options === undefined) {
    // do nothing
  } else if (typeof options === "function") {
    callback = options
  } else {
    callback = done
  }

  if (callback) {
    process.nextTick(function() {
      done(work(originalSrc))
    })
    return
  }

  function work(obj) {
    try {
      // Uses module to sort all objects key names based on standard
      // string ordering.
      var deepSorted = deep_sort_object(obj)

      // Once object keys are sorted, we still need to check for arrays.
      var out = deepInspect(deepSorted)
      return out
    } catch (e) {
      console.log(e)
      throw e
    }
  }

  return work(originalSrc)
}
function sortObject(originalSrc, options, done) {
  var callback

  if (options === undefined) {
    // do nothing
  } else if (typeof options === "function") {
    callback = options
  } else {
    callback = done
  }

  if (callback) {
    process.nextTick(function() {
      done(work(originalSrc))
    })
    return
  }

  function work(obj) {
    try {
      // Uses module to sort all objects key names based on standard
      // string ordering.
      var deepSorted = deep_sort_object(obj)

      // Once object keys are sorted, we still need to check for arrays.
      var out = deepInspect(deepSorted)
      return out
    } catch (e) {
      console.log(e)
      throw e
    }
  }

  return work(originalSrc)
}
function sortObject ( originalSrc , options , done ) { var callback if ( options === undefined ) { // do nothing } else if ( typeof options === "function" ) { callback = options } else { callback = done } if ( callback ) { process . nextTick ( function ( ) { done ( work ( originalSrc ) ) } ) return } function work ( obj ) { try { // Uses module to sort all objects key names based on standard // string ordering. var deepSorted = deep_sort_object ( obj ) // Once object keys are sorted, we still need to check for arrays. var out = deepInspect ( deepSorted ) return out } catch ( e ) { console . log ( e ) throw e } } return work ( originalSrc ) }
Will return a deep sorted version of the object.
Will return a deep sorted version of the object .