Comparing version 1.1.0 to 2.0.0
13
index.js
@@ -5,15 +5,16 @@ 'use strict'; | ||
module.exports = (versions, options) => { | ||
options = Object.assign({ | ||
options = { | ||
includePrereleases: true, | ||
clean: true | ||
}, options); | ||
clean: true, | ||
...options | ||
}; | ||
let sortedVersions = versions.filter(x => semver.valid(x)).sort(semver.rcompare); | ||
let sortedVersions = versions.filter(version => semver.valid(version)).sort(semver.rcompare); | ||
if (!options.includePrereleases) { | ||
sortedVersions = sortedVersions.filter(x => semver.prerelease(x) === null); | ||
sortedVersions = sortedVersions.filter(version => semver.prerelease(version) === null); | ||
} | ||
if (options.clean) { | ||
sortedVersions = sortedVersions.map(x => semver.clean(x)); | ||
sortedVersions = sortedVersions.map(version => semver.clean(version)); | ||
} | ||
@@ -20,0 +21,0 @@ |
{ | ||
"name": "to-semver", | ||
"version": "1.1.0", | ||
"description": "Get an array of valid, sorted, and cleaned semver versions from an array of strings", | ||
"license": "MIT", | ||
"repository": "sindresorhus/to-semver", | ||
"author": { | ||
"name": "Sindre Sorhus", | ||
"email": "sindresorhus@gmail.com", | ||
"url": "sindresorhus.com" | ||
}, | ||
"engines": { | ||
"node": ">=4" | ||
}, | ||
"scripts": { | ||
"test": "xo && ava" | ||
}, | ||
"files": [ | ||
"index.js" | ||
], | ||
"keywords": [ | ||
"semver", | ||
"semantic", | ||
"version", | ||
"versions", | ||
"versioning", | ||
"list", | ||
"array", | ||
"clean", | ||
"sort", | ||
"cleaned", | ||
"sorted", | ||
"valid", | ||
"validated", | ||
"filter", | ||
"filtered", | ||
"git", | ||
"tag", | ||
"tags" | ||
], | ||
"dependencies": { | ||
"semver": "^5.3.0" | ||
}, | ||
"devDependencies": { | ||
"ava": "*", | ||
"xo": "*" | ||
} | ||
"name": "to-semver", | ||
"version": "2.0.0", | ||
"description": "Get an array of valid, sorted, and cleaned semver versions from an array of strings", | ||
"license": "MIT", | ||
"repository": "sindresorhus/to-semver", | ||
"author": { | ||
"name": "Sindre Sorhus", | ||
"email": "sindresorhus@gmail.com", | ||
"url": "sindresorhus.com" | ||
}, | ||
"engines": { | ||
"node": ">=8" | ||
}, | ||
"scripts": { | ||
"test": "xo && ava && tsd" | ||
}, | ||
"files": [ | ||
"index.js", | ||
"index.d.ts" | ||
], | ||
"keywords": [ | ||
"semver", | ||
"semantic", | ||
"version", | ||
"versions", | ||
"versioning", | ||
"list", | ||
"array", | ||
"clean", | ||
"sort", | ||
"cleaned", | ||
"sorted", | ||
"valid", | ||
"validated", | ||
"filter", | ||
"filtered", | ||
"git", | ||
"tag", | ||
"tags" | ||
], | ||
"dependencies": { | ||
"semver": "^6.0.0" | ||
}, | ||
"devDependencies": { | ||
"ava": "^1.4.1", | ||
"tsd": "^0.7.2", | ||
"xo": "^0.24.0" | ||
} | ||
} |
# to-semver [![Build Status](https://travis-ci.org/sindresorhus/to-semver.svg?branch=master)](https://travis-ci.org/sindresorhus/to-semver) | ||
> Get an array of valid, sorted, and cleaned [semver](http://semver.org) versions from an array of strings | ||
> Get an array of valid, sorted, and cleaned [semver](https://semver.org) versions from an array of strings | ||
@@ -46,3 +46,3 @@ Can be useful when you have an unsorted list of versions, like git tags, and want to use them as semver versions. | ||
Type: `Object` | ||
Type: `object` | ||
@@ -49,0 +49,0 @@ ##### includePrereleases |
Sorry, the diff of this file is not supported yet
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
4560
5
54
3
+ Addedsemver@6.3.1(transitive)
- Removedsemver@5.7.2(transitive)
Updatedsemver@^6.0.0