Socket
Socket
Sign inDemoInstall

at-least-node

Package Overview
Dependencies
0
Maintainers
1
Versions
1
Alerts
File Explorer

Advanced tools

Install Socket

Detect and block malicious and high-risk dependencies

Install

    at-least-node

Lightweight Node.js version sniffing/comparison


Version published
Weekly downloads
16M
increased by2.06%
Maintainers
1
Install size
3.38 kB
Created
Weekly downloads
 

Package description

What is at-least-node?

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.

What are at-least-node's main functionalities?

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');

Other packages similar to at-least-node

Readme

Source

at-least-node

npm node NPM

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.

PackageSize
at-least-node2.6 kB
semver75.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:

  • You cannot include a leading v (i.e. v10.12.0)
  • You cannot omit sections (i.e. 10.12)
  • You cannot use pre-releases (i.e. 1.0.0-beta)
  • There is no input validation, if you make a mistake, the resulting behavior is undefined

Keywords

FAQs

Last updated on 01 Feb 2020

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.

Install

Related posts

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc