Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
https://github.com/guillermooo/dart-semver
Semantic Versioning Tag Parser for Dart
https://github.com/guillermooo/dart-semver
Last synced: about 1 month ago
JSON representation
Semantic Versioning Tag Parser for Dart
- Host: GitHub
- URL: https://github.com/guillermooo/dart-semver
- Owner: guillermooo
- License: bsd-3-clause
- Created: 2014-06-26T19:41:42.000Z (over 10 years ago)
- Default Branch: master
- Last Pushed: 2016-07-31T18:36:58.000Z (over 8 years ago)
- Last Synced: 2023-08-20T23:04:30.292Z (over 1 year ago)
- Language: Dart
- Size: 207 KB
- Stars: 7
- Watchers: 3
- Forks: 5
- Open Issues: 1
-
Metadata Files:
- Readme: README.md
- License: LICENSE.txt
Awesome Lists containing this project
README
[![Build Status](https://drone.io/github.com/guillermooo/dart-semver/status.png)](https://drone.io/github.com/guillermooo/dart-semver/latest)
A version parser for tags formed after the [semantic versioning convention][1].
[1]: http://semver.org
### Parsing versions
```dart
import 'package:semver/semver.dart';// from strings
var sm = new SemanticVersion.fromString('0.1.0');// from maps
var myver = {'major': 10, 'minor': 5, 'patch': 1, build: '200'};
var sm = new SemanticVersion.fromMap(myver);// directly
var newver = SemanticVersion(20, 10, 0, pre: 'alpha');
```### Comparing versions
```dart
import 'package:semver/semver.dart';var sm1 = new SemanticVersion.fromString('0.1.0+200');
var sm2 = new SemanticVersion.fromString('0.1.0+400');assert(sm1 == sm2); // true
var sm3 = new SemanticVersion.fromString('0.1.0-alpha');
var sm4 = new SemanticVersion.fromString('0.1.0');assert(sm3 < sm4); // true
```