From 2028c27705dc87af4d092123dace11b147ddae0c Mon Sep 17 00:00:00 2001 From: Feross Aboukhadijeh Date: Wed, 23 Mar 2016 19:45:03 -0700 Subject: [PATCH] Fixes to PR #109 --- index.js | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/index.js b/index.js index 6f85398..c939c81 100644 --- a/index.js +++ b/index.js @@ -286,7 +286,11 @@ Buffer.compare = function compare (a, b) { var y = b.length for (var i = 0, len = Math.min(x, y); i < len; ++i) { - if (a[i] !== b[i]) return a[i] > b[i] ? 1 : -1 + if (a[i] !== b[i]) { + x = a[i] + y = b[i] + break + } } if (x < y) return -1 -- 2.34.1