module.exports = function(a, b) {
  if (a === b) return 0

  var x = a.length
  var y = b.length

  var i = 0
  var len = Math.min(x, y)
  while (i < len) {
    if (a[i] !== b[i]) break

    ++i
  }

  if (i !== len) {
    x = a[i]
    y = b[i]
  }

  if (x < y) return -1
  if (y < x) return 1
  return 0
}


@@ -27,16 +27,75 @@
 a, b) %7B%0A
+  if (typeof a.compare === 'function') return a.compare(b)%0A
   if (a 

use Buffer.compare if it exists