
Security News
Node.js TSC Votes to Stop Distributing Corepack
Corepack will be phased out from future Node.js releases following a TSC vote.
has-bigints
Advanced tools
The has-bigints npm package is a simple utility that allows developers to check if the JavaScript environment they are working in supports BigInts. BigInts are a type of data in JavaScript that can represent whole numbers larger than 2^53 - 1, which is the largest number JavaScript can reliably represent with the Number primitive. This package is particularly useful for writing code that needs to be compatible with various JavaScript environments, including older browsers or JavaScript engines that do not support BigInts.
Checking for BigInt support
This feature allows developers to programmatically check if the current JavaScript environment supports BigInts. The function returns a boolean value, true if BigInts are supported and false otherwise. This is useful for conditional code execution based on BigInt support.
const hasBigInts = require('has-bigints');
if (hasBigInts()) {
console.log('This environment supports BigInts.');
} else {
console.log('BigInts are not supported in this environment.');
}
The big-integer package is a JavaScript library for arbitrary-precision integer arithmetic. Unlike has-bigints, which is a utility for checking BigInt support, big-integer provides its own implementation for handling large integers, making it useful in environments that do not support BigInt natively.
bignumber.js is another library for arbitrary-precision arithmetic in JavaScript. Similar to big-integer, it does not rely on native BigInt support and can perform mathematical operations on large numbers. It offers more comprehensive features for arithmetic operations compared to has-bigints, which is solely focused on checking for BigInt support.
Determine if the JS environment has BigInt support.
var hasBigInts = require('has-bigints');
hasBigInts() === true; // if the environment has native BigInt support. Not polyfillable, not forgeable.
Simply clone the repo, npm install
, and run npm test
v1.1.0 - 2024-12-18
npmignore
to autogenerate an npmignore file a411cea
4515878
c888241
6f44338
@ljharb/eslint-config
, auto-changelog
, npmignore
, tape
ffa1e4d
aud
, tape
0f5d096
engines.node
3f73c71
aud
with npm audit
b007efd
459c612
FAQs
Determine if the JS environment has BigInt support.
The npm package has-bigints receives a total of 28,938,491 weekly downloads. As such, has-bigints popularity was classified as popular.
We found that has-bigints 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.
Security News
Corepack will be phased out from future Node.js releases following a TSC vote.
Research
Security News
Research uncovers Black Basta's plans to exploit package registries for ransomware delivery alongside evidence of similar attacks already targeting open source ecosystems.
Security News
Oxlint's beta release introduces 500+ built-in linting rules while delivering twice the speed of previous versions, with future support planned for custom plugins and improved IDE integration.