Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
https://github.com/boxuk/versions
Simple tool for comparing version numbers in Clojure and ClojureScript
https://github.com/boxuk/versions
Last synced: about 2 months ago
JSON representation
Simple tool for comparing version numbers in Clojure and ClojureScript
- Host: GitHub
- URL: https://github.com/boxuk/versions
- Owner: boxuk
- Created: 2012-01-29T16:09:29.000Z (almost 13 years ago)
- Default Branch: master
- Last Pushed: 2013-05-28T13:16:31.000Z (over 11 years ago)
- Last Synced: 2024-09-28T01:17:49.367Z (3 months ago)
- Language: Clojure
- Homepage: http://www.boxuk.com
- Size: 165 KB
- Stars: 2
- Watchers: 12
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
Awesome Lists containing this project
README
# Versions [![Build Status](https://secure.travis-ci.org/boxuk/versions.png?branch=master)](http://travis-ci.org/boxuk/versions) [![Dependencies Status](http://clj-deps.herokuapp.com/github/boxuk/versions/status.png)](http://clj-deps.herokuapp.com/github/boxuk/versions)
Versions is a super-simple library for comparing version numbers.
## Usage
Just pass version strings to the comparison functions.
```clojure
(use boxuk.versions)(later-version? "1.0.0" "1.0.1") ; true
(later-version? "2.1.0" "1.2.0") ; false(earlier-version? "1.0" "0.0.9" ) ; true
(earlier-version? "0.9.0" "0.10" ) ; false(same-version? "0.1" "0.1.0.0.0.0" ) ; true
(same-version? "2.1" "1.2") ; false
```You can also filter a sequence for the latest or earliest version.
```clojure
(latest-version ["1.1" "2.3"]) ; "2.3"
(earliest-version ["2.4" "3.4.2"]) ; "2.4"
```## Stable/Unstable
Versions can make a distinction between stable and unstable versions.
Unstable versions are anything postfixed with for example _alpha_, _RC_, or _SNAPSHOT_.```clojure
(stable? "1.2.3-SNAPSHOT") ; false
(unstable? "1.2.3-alpha2") ; true(latest-stable ["1.2.2" "1.2.2-SNAPSHOT"] ; "1.2.2"
```The order of comparison for unstable versions is:
```clojure
(> "SNAPSHOT" "RC" "beta" "alpha")
```# Installation
Versions is available from [Clojars](http://clojars.org/boxuk/versions)
## ClojureScript
Versions also supports being used via ClojureScript.
## License
Dual licensed under GPLv2 and MIT.