Security News
How Threat Actors are Abusing GitHub’s File Upload Feature to Host Malware
GitHub is susceptible to a CDN flaw that allows attackers to host malware on any public repository.
at-least-node
Advanced tools
Package description
The 'at-least-node' package is designed to ensure that a Node.js application or script is running on a minimum specified version of Node.js. It is particularly useful for developers who want to enforce a version requirement for their applications, preventing the application from running if the Node.js environment does not meet the specified minimum version. This can help avoid unexpected behavior or errors caused by using features that are not supported in older versions of Node.js.
Version Checking
This feature allows developers to specify a minimum Node.js version requirement. The code example checks if the current Node.js version is at least version 10.0.0. If the version is older, the script will throw an error and prevent the application from running.
require('at-least-node')('10.0.0');
The 'semver' package is a module for semantic versioning comparison. While it does not directly enforce Node.js version requirements, it can be used to perform complex version checks and comparisons, including checking if the current Node.js version satisfies a given version range. This provides more flexibility compared to 'at-least-node' but requires additional code to enforce version requirements.
Similar to 'at-least-node', 'please-upgrade-node' is a package designed to enforce a minimum Node.js version requirement for applications. It goes a step further by providing a friendly error message advising users to upgrade their Node.js version if the requirement is not met. This makes it a more user-friendly option compared to 'at-least-node', which simply throws an error without additional guidance.
The 'engine-check' package automatically checks if the current Node.js version satisfies the version specified in the 'engines' field of 'package.json'. It is similar to 'at-least-node' in enforcing version requirements but does so based on the project's package.json configuration, offering a more integrated approach to version enforcement.
Readme
Sometimes you need to check if you're on at least a given Node.js version, but you don't want to pull in the whole semver
kitchen sink. That's what at-least-node
is for.
Package | Size |
---|---|
at-least-node | 2.6 kB |
semver | 75.5 kB |
const atLeastNode = require('at-least-node')
atLeastNode('10.12.0')
// -> true on Node 10.12.0+, false on anything below that
When passing in a version string:
v
(i.e. v10.12.0
)10.12
)1.0.0-beta
)FAQs
Lightweight Node.js version sniffing/comparison
The npm package at-least-node receives a total of 12,873,183 weekly downloads. As such, at-least-node popularity was classified as popular.
We found that at-least-node demonstrated a not healthy version release cadence and project activity because the last version was released 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.
Security News
GitHub is susceptible to a CDN flaw that allows attackers to host malware on any public repository.
Security News
At Node Congress, Socket CEO Feross Aboukhadijeh uncovers the darker aspects of open source, where applications that rely heavily on third-party dependencies can be exploited in supply chain attacks.
Research
Security News
The Socket Research team found this npm package includes code for collecting sensitive developer information, including your operating system username, Git username, and Git email.