GitHub - emilbayes/buffer-compare-numeric: Compare Buffers numerically
Skip to content

emilbayes/buffer-compare-numeric

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

4 Commits
 
 
 
 
 
 
 
 
 
 

Repository files navigation

buffer-compare-numeric

Compare (Big Endian) Buffers numerically

Install

npm install buffer-compare-numeric

Usage

Will compare (Big Endian) Buffers numerically, ignoring leading zeros.

var cmp = require('buffer-compare-numeric')

var a = Buffer([16])
var b = Buffer([00, 17])

[a, b].sort(Buffer.compare) // [b, a]
[a, b].sort(cmp) // [a, b]

License

ISC

About

Compare Buffers numerically

Resources

License

Stars

Watchers

Forks

Packages

No packages published