Huge News!Announcing our $40M Series B led by Abstract Ventures.Learn More
Socket
Sign inDemoInstall
Socket

to-semver

Package Overview
Dependencies
Maintainers
1
Versions
5
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

to-semver - npm Package Compare versions

Comparing version 1.1.0 to 2.0.0

index.d.ts

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

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc