Skip to content
Node: buf.compare(other)github.com/sahilkhaire/gox/buffer

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) int

Compare: 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)

← Back to buffer package overview

MIT Licensed · Built for Node.js developers moving to Go