New Research: Supply Chain Attack on Axios Pulls Malicious Dependency from npm.Details
Socket
Book a DemoSign in
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

Truncate a semver version: `1.2.3` → `1.2.0`

latest
Source
npmnpm
Version
3.0.0
Version published
Weekly downloads
3.7M
-11.87%
Maintainers
1
Weekly downloads
 
Created
Source

semver-truncate

Truncate a semver version: 1.2.31.2.0

Install

$ npm install semver-truncate

Usage

import semverTruncate from '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.

  • 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

Keywords

semver

FAQs

Package last updated on 28 Apr 2021

Did you know?

Socket

Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.

Install

Related posts