semver-truncate

WebJar for semver-truncate

License

License

MIT
GroupId

GroupId

org.webjars.npm
ArtifactId

ArtifactId

semver-truncate
Last Version

Last Version

1.0.0
Release Date

Release Date

Type

Type

jar
Description

Description

semver-truncate
WebJar for semver-truncate
Project URL

Project URL

http://webjars.org
Source Code Management

Source Code Management

https://github.com/sindresorhus/semver-truncate

Download semver-truncate

How to add to project

<!-- https://jarcasting.com/artifacts/org.webjars.npm/semver-truncate/ -->
<dependency>
    <groupId>org.webjars.npm</groupId>
    <artifactId>semver-truncate</artifactId>
    <version>1.0.0</version>
</dependency>
// https://jarcasting.com/artifacts/org.webjars.npm/semver-truncate/
implementation 'org.webjars.npm:semver-truncate:1.0.0'
// https://jarcasting.com/artifacts/org.webjars.npm/semver-truncate/
implementation ("org.webjars.npm:semver-truncate:1.0.0")
'org.webjars.npm:semver-truncate:jar:1.0.0'
<dependency org="org.webjars.npm" name="semver-truncate" rev="1.0.0">
  <artifact name="semver-truncate" type="jar" />
</dependency>
@Grapes(
@Grab(group='org.webjars.npm', module='semver-truncate', version='1.0.0')
)
libraryDependencies += "org.webjars.npm" % "semver-truncate" % "1.0.0"
[org.webjars.npm/semver-truncate "1.0.0"]

Dependencies

compile (1)

Group / Artifact Type Version
org.webjars.npm : semver jar [4.0.3,5)

Project Modules

There are no modules declared in this project.

semver-truncate

Truncate a semver version: 1.2.31.2.0

Install

$ npm install semver-truncate

Usage

const semverTruncate = require('semver-truncate');

semverTruncate('1.2.3-foo', 'patch');
//=> '1.2.3'

semverTruncate('1.2.3', 'minor');
//=> '1.2.0'

semverTruncate('1.2.3', 'major');
//=> '1.0.0'

API

truncateSemver(version, type)

version

Type: string

Semver version.

type

Type: 'patch' | 'minor' | 'major'

Version type to truncate to.

Related

  • latest-semver - Get the latest stable semver version from an array of versions
  • to-semver - Get an array of valid, sorted, and cleaned semver versions from an array of strings
  • semver-regex - Regular expression for matching semver versions
  • semver-diff - Get the diff type of two semver versions: 0.0.1 0.0.2patch

License

MIT © Sindre Sorhus

Versions

Version
1.0.0