This commit is contained in:
AJ ONeal 2018-03-28 00:08:49 -06:00
parent 361e1dd788
commit 540c7430df
2 changed files with 28 additions and 32 deletions

View File

@ -1,4 +1,6 @@
## semver-utils
## semver-utils.js
| Sponsored by [ppl](https://ppl.family)
Some utils that aren't provided by the mainstream `semver` module.
@ -11,10 +13,9 @@ npm install --save semver-utils
```javascript
'use strict';
var semverUtils = require('semver-utils')
, version = require('./package.json').version
, semver = semverUtils.parse(version)
;
var semverUtils = require('semver-utils');
var version = require('./package.json').version;
var semver = semverUtils.parse(version);
console.log(semver);
```
@ -30,8 +31,7 @@ console.log(semver);
Turns a string such as `1.0.6-1+build-623` into the object
{
semver: '1.0.6-1+build-623'
{ semver: '1.0.6-1+build-623'
, version: '1.0.6'
, major: '1'
, minor: '0'
@ -46,8 +46,7 @@ returns `null` on **error**
Creates a string such as `1.0.6-1+build-623` from the object
{
major: '1'
{ major: '1'
, minor: '0'
, patch: '6'
, release: '1'
@ -96,25 +95,21 @@ Creates a range string such as `>= 1.1.7 < 2.0.0 || 1.1.3`
from an array of semver objects (and operators) such as
[
{
"semver": ">= v1.1.7"
{ "semver": ">= v1.1.7"
, "operator": ">="
, "major": 1
, "minor": 1
, "patch": 7
}
, {
"semver": "< v2.0.0"
, { "semver": "< v2.0.0"
, "operator": "<"
, "major": 2
, "minor": 0
, "patch": 0
}
, {
"operator": "||"
, { "operator": "||"
}
, {
"semver": "v1.1.3"
, { "semver": "v1.1.3"
, "operator": "="
, "major": 1
, "minor": 1

View File

@ -1,14 +1,15 @@
{
"name": "semver-utils",
"version": "1.1.0",
"version": "1.1.1",
"description": "Tools for manipulating semver strings and objects",
"homepage": "https://git.coolaj86.com/coolaj86/semver-utils.js",
"main": "semver-utils.js",
"scripts": {
"test": "mocha"
},
"repository": {
"type": "git",
"url": "git://github.com/coolaj86/semver-utils.git"
"url": "git://git.coolaj86.com/coolaj86/semver-utils.js.git"
},
"keywords": [
"semver",