Skip to content

Compare version strings according to Semantic Versioning 2.0.0

License

Notifications You must be signed in to change notification settings

hobbyquaker/semantic-compare

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

5 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

semantic-compare

NPM version Build Status Coverage Status XO code style License

Compare version strings according to Semantic Versioning 2.0.0

Example

const semverCompare = require('semantic-compare');

console.log([
    '1.0.0-alpha.1',
    '1.0.0-beta',
    '1.0.0',
    '1.0.0-alpha.beta',
    '1.0.0-rc.1',
    '1.0.0-beta.2',
    '1.0.0-alpha',
    '1.0.0-beta.11'
].sort(semverCompare));

Output:

[ '1.0.0-alpha',
  '1.0.0-alpha.1',
  '1.0.0-alpha.beta',
  '1.0.0-beta',
  '1.0.0-beta.2',
  '1.0.0-beta.11',
  '1.0.0-rc.1',
  '1.0.0' ]

License

MIT (c) Sebastian Raff

About

Compare version strings according to Semantic Versioning 2.0.0

Topics

Resources

License

Stars

Watchers

Forks

Packages

No packages published