return buf
}
+Buffer.compare = function (a, b) {
+ assert(Buffer.isBuffer(a) && Buffer.isBuffer(b), 'Arguments must be Buffers')
+ var x = a.length
+ var y = b.length
+ for (var i = 0, len = Math.min(x, y); i < len && a[i] === b[i]; i++) {}
+ if (i !== len) {
+ x = a[i]
+ y = b[i]
+ }
+ if (x < y) {
+ return -1
+ }
+ if (y < x) {
+ return 1
+ }
+ return 0
+}
+
// BUFFER INSTANCE METHODS
// =======================
}
}
+Buffer.prototype.equals = function (b) {
+ assert(Buffer.isBuffer(b), 'Argument must be a Buffer')
+ console.log(this, b)
+ return Buffer.compare(this, b) === 0
+}
+
+Buffer.prototype.compare = function (b) {
+ assert(Buffer.isBuffer(b), 'Argument must be a Buffer')
+ return Buffer.compare(this, b)
+}
+
// copy(targetBuffer, targetStart=0, sourceStart=0, sourceEnd=buffer.length)
Buffer.prototype.copy = function (target, target_start, start, end) {
var source = this
arr.toString = BP.toString
arr.toLocaleString = BP.toString
arr.toJSON = BP.toJSON
+ arr.equals = BP.equals
+ arr.compare = BP.compare
arr.copy = BP.copy
arr.slice = BP.slice
arr.readUInt8 = BP.readUInt8