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

semver-truncate

Package Overview
Dependencies
Maintainers
1
Versions
6
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

semver-truncate - npm Package Compare versions

Comparing version 1.1.2 to 2.0.0

index.d.ts

10

index.js
'use strict';
var semver = require('semver');
const semver = require('semver');
module.exports = function (version, type) {
if (['major', 'minor', 'patch'].indexOf(type) === -1) {
throw new TypeError('Invalid version type');
module.exports = (version, type) => {
if (!['major', 'minor', 'patch'].includes(type)) {
throw new TypeError(`Invalid version type: ${version}`);
}

@@ -12,3 +12,3 @@

if (!version) {
throw new Error('Version ' + version + ' is not valid semver');
throw new Error(`Version ${version} is not valid semver`);
}

@@ -15,0 +15,0 @@

{
"name": "semver-truncate",
"version": "1.1.2",
"description": "Truncate a semver version: 1.2.3 → 1.2.0",
"license": "MIT",
"repository": "sindresorhus/semver-truncate",
"author": {
"name": "Sindre Sorhus",
"email": "sindresorhus@gmail.com",
"url": "sindresorhus.com"
},
"engines": {
"node": ">=0.10.0"
},
"scripts": {
"test": "xo && ava"
},
"files": [
"index.js"
],
"keywords": [
"semver",
"version",
"semantic",
"truncate",
"shorten",
"simplify"
],
"dependencies": {
"semver": "^5.3.0"
},
"devDependencies": {
"ava": "*",
"xo": "*"
}
"name": "semver-truncate",
"version": "2.0.0",
"description": "Truncate a semver version: `1.2.3` → `1.2.0`",
"license": "MIT",
"repository": "sindresorhus/semver-truncate",
"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",
"version",
"semantic",
"truncate",
"shorten",
"simplify"
],
"dependencies": {
"semver": "^6.0.0"
},
"devDependencies": {
"ava": "^1.4.1",
"tsd": "^0.7.2",
"xo": "^0.24.0"
}
}

@@ -9,3 +9,3 @@ # semver-truncate [![Build Status](https://travis-ci.org/sindresorhus/semver-truncate.svg?branch=master)](https://travis-ci.org/sindresorhus/semver-truncate)

```
$ npm install --save semver-truncate
$ npm install semver-truncate
```

@@ -42,4 +42,3 @@

Type: `string`
Values: `patch` `minor` `major`
Type: `'patch' | 'minor' | 'major'`

@@ -49,4 +48,12 @@ Version type to truncate to.

## Related
- [latest-semver](https://github.com/sindresorhus/latest-semver) - Get the latest stable semver version from an array of versions
- [to-semver](https://github.com/sindresorhus/to-semver) - Get an array of valid, sorted, and cleaned semver versions from an array of strings
- [semver-regex](https://github.com/sindresorhus/semver-regex) - Regular expression for matching semver versions
- [semver-diff](https://github.com/sindresorhus/semver-diff) - Get the diff type of two semver versions: `0.0.1` `0.0.2` → `patch`
## License
MIT © [Sindre Sorhus](https://sindresorhus.com)

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