Research
Security News
Malicious npm Packages Inject SSH Backdoors via Typosquatted Libraries
Socket’s threat research team has detected six malicious npm packages typosquatting popular libraries to insert SSH backdoors.
@types/semver
Advanced tools
TypeScript definitions for semver
The @types/semver package provides TypeScript type definitions for the semver package, which is a utility for handling semantic versions. It allows developers to parse, compare, and manipulate semantic versions in TypeScript projects with type safety.
Parsing a version
This feature allows you to parse a semantic version string and access its components, such as the major, minor, and patch versions.
"import semver from 'semver';\nconst version = semver.parse('1.2.3');\nconsole.log(version.major); // 1"
Comparing versions
This feature enables you to compare two semantic version strings and determine their order.
"import semver from 'semver';\nconst result = semver.compare('1.2.3', '1.2.4');\nconsole.log(result); // -1"
Satisfying ranges
This functionality allows you to check if a semantic version satisfies a given version range.
"import semver from 'semver';\nconst satisfied = semver.satisfies('1.2.3', '^1.0.0');\nconsole.log(satisfied); // true"
This package provides functionality for comparing version numbers. While it offers similar version comparison capabilities, it lacks the broader feature set of semver, such as range checking and version parsing.
A simple package for comparing version strings. It is more lightweight than semver but does not support semantic versioning's pre-release and build metadata.
npm install --save @types/semver
This package contains type definitions for semver (https://github.com/npm/node-semver).
Files were exported from https://github.com/DefinitelyTyped/DefinitelyTyped/tree/master/types/semver.
These definitions were written by Bart van der Schoor, BendingBender, Lucian Buzzo, Klaus Meinhardt, ExE Boss, and Piotr Błażejewicz.
FAQs
TypeScript definitions for semver
The npm package @types/semver receives a total of 20,258,284 weekly downloads. As such, @types/semver popularity was classified as popular.
We found that @types/semver demonstrated a healthy version release cadence and project activity because the last version was released less than a year ago. It has 1 open source maintainer collaborating on the project.
Did you know?
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.
Research
Security News
Socket’s threat research team has detected six malicious npm packages typosquatting popular libraries to insert SSH backdoors.
Security News
MITRE's 2024 CWE Top 25 highlights critical software vulnerabilities like XSS, SQL Injection, and CSRF, reflecting shifts due to a refined ranking methodology.
Security News
In this segment of the Risky Business podcast, Feross Aboukhadijeh and Patrick Gray discuss the challenges of tracking malware discovered in open source softare.