Repository URL to install this package:
|
Version:
3.0.0-1 ▾
|
vending-agent-dep
/
usr
/
local
/
lib
/
vending
/
agent
/
node_modules
/
dpkg-compare-versions
/
README.md
|
|---|
Pure javascript implementation of the dpkg --compare-versions functionality.
This implementation is a port of the C implementation of dpkg. Supports epoch, version and revision.
First you will need to install from the npm package repository:
npm install --save dpkg-compare-versions
Then you'll be able to require it in your program.
const compare = require('dpkg-compare-versions'); compare('1.1.1', '1.0.1') // returns 1 compare('1.0.0', '1.0.0') // returns 0 compare('1.0.0~rc1', '1.0.0') // returns -1 compare('2:1.0.0', '1:2.0.0') // returns 1
You can also use this function to sort packages:
const compare = require('dpkg-compare-versions') const versions = [ '2.1', '1.2.2', '3-3' ] versions.sort(compare) // versions = [ '1.2.2', '2.1', '3-3' ]
You can find more information about how sorting works in the deb-version (5) manual page.
Tests can be run by executing the command npm test. This will run standard and jest.
The package has 100% coverage tests. This can be verified by running npm run coverage.
Contributions are welcome, but are expected to pass the npm test command.