Compare
Overview
Compare compares two buffers lexicographically (Buffer.compare).
If you are coming from Node.js, the closest pattern is buf.compare(other).
Signature
go
func Compare(a, b Buffer) intCompare: Node.js · Standard Go · gox
js
buf.compare(other)go
ok := bytes.Equal(a, b)go
import "github.com/sahilkhaire/gox/buffer"
buffer.Compare(a, b)Example
go
import "github.com/sahilkhaire/gox/buffer"
buffer.Compare(a, b)Tips
Import github.com/sahilkhaire/gox/buffer and call Compare directly. See the comparison below for the standard library equivalent.
Standard library alternative
Use the standard library directly:
go
ok := bytes.Equal(a, b)