semver-lite
Advanced tools
Comparing version 0.0.3 to 0.0.4
@@ -6,3 +6,3 @@ { | ||
"name": "semver-lite", | ||
"version": "0.0.3", | ||
"version": "0.0.4", | ||
"keywords": [ | ||
@@ -9,0 +9,0 @@ "semver", |
@@ -86,3 +86,3 @@ (function webpackUniversalModuleDefinition(root, factory) { | ||
var semver = { | ||
version: '0.0.3', | ||
version: '0.0.4', | ||
SemverVersion: SemverVersion, | ||
@@ -123,3 +123,3 @@ validate: function validate(version) { | ||
mainVersionToNumeric: function mainVersionToNumeric(version) { | ||
var digit = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : 4; | ||
var digit = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : 6; | ||
@@ -200,3 +200,3 @@ var semverVersion = new SemverVersion(version); | ||
this.prereleaseArray = matches[4].split('.').map(function (id) { | ||
if (/^[0-9]+$/.test(id)) { | ||
if (REGEX_NUMERIC.test(id)) { | ||
var num = +id; | ||
@@ -203,0 +203,0 @@ if (num >= 0 && num < MAX_SAFE_INTEGER) { |
{ | ||
"name": "semver-lite", | ||
"version": "0.0.3", | ||
"version": "0.0.4", | ||
"description": "semver compare library", | ||
@@ -5,0 +5,0 @@ "main": "src/index.js", |
@@ -79,4 +79,6 @@ # semver-lite [![Build Status](https://api.travis-ci.org/worktile/semver-lite.svg?branch=master)](https://travis-ci.org/worktile/semver-lite) | ||
``` | ||
semver.compare('2.0.0+20171013', '2.0.0+20171014'); // 0 default false don't compare build version `20171014` | ||
semver.compare('2.0.0+20171013', '2.0.0+20171014', true); // -1 compare build version `20171014` | ||
// default false don't compare build version `20171014` | ||
semver.compare('2.0.0+20171013', '2.0.0+20171014'); // 0 | ||
// compare build version `20171014` | ||
semver.compare('2.0.0+20171013', '2.0.0+20171014', true); // -1 | ||
``` | ||
@@ -83,0 +85,0 @@ |
const SemverVersion = require('./semver'); | ||
const semver = { | ||
version: '0.0.3', | ||
version: '0.0.4', | ||
SemverVersion: SemverVersion, | ||
@@ -38,3 +38,3 @@ validate(version) { | ||
// 主版本转成数字类型方便比较 | ||
mainVersionToNumeric(version, digit = 4) { | ||
mainVersionToNumeric(version, digit = 6) { | ||
const semverVersion = new SemverVersion(version); | ||
@@ -41,0 +41,0 @@ return semverVersion.mainVersionToNumeric(digit); |
@@ -55,3 +55,3 @@ const MAX_LENGTH = 256; | ||
this.prereleaseArray = matches[4].split('.').map(function (id) { | ||
if (/^[0-9]+$/.test(id)) { | ||
if (REGEX_NUMERIC.test(id)) { | ||
var num = +id; | ||
@@ -58,0 +58,0 @@ if (num >= 0 && num < MAX_SAFE_INTEGER) { |
@@ -98,11 +98,11 @@ const test = require('ava'); | ||
test('version 1.10.12-beta+20130222 main version to numeric is 100100012', async t => { | ||
t.is(semver.mainVersionToNumeric('1.10.12'), 100100012); | ||
t.is(semver.mainVersionToNumeric('1.10.12', 4), 100100012); | ||
}); | ||
test('version 1.10.12-beta+20130222 main version to numeric is 100100012', async t => { | ||
t.is(semver.mainVersionToNumeric('1.10.12', 6), 1000010000012); | ||
t.is(semver.mainVersionToNumeric('1.10.12'), 1000010000012); | ||
}); | ||
test('version 1.10111.12 main version to numeric is 1101110012', async t => { | ||
t.is(semver.mainVersionToNumeric('1.10111.12'), 1101110012); | ||
t.is(semver.mainVersionToNumeric('1.10111.12', 4), 1101110012); | ||
}); | ||
@@ -109,0 +109,0 @@ |
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
43384
94