Socket
Socket
Sign inDemoInstall

has-bigints

Package Overview
Dependencies
0
Maintainers
1
Versions
3
Alerts
File Explorer

Advanced tools

Install Socket

Detect and block malicious and high-risk dependencies

Install

    has-bigints

Determine if the JS environment has BigInt support.


Version published
Maintainers
1
Install size
13.3 kB
Created

Package description

What is has-bigints?

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.

What are has-bigints's main functionalities?

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

Other packages similar to has-bigints

Changelog

Source

v1.0.2 - 2022-04-19

Commits

  • [actions] reuse common workflows a655b7f
  • [actions] use node/install instead of node/run; use codecov action 730a2e5
  • [readme] add github actions/codecov badges; update URLs 9a83788
  • [Dev Deps] update eslint, @ljharb/eslint-config, safe-publish-latest, tape b1edc52
  • [actions] update codecov uploader cbb1bd0
  • [Dev Deps] update eslint, @ljharb/eslint-config, aud, auto-changelog, tape 8717e6d
  • [Dev Deps] update eslint, @ljharb/eslint-config, auto-changelog, safe-publish-latest, tape 5f70eab
  • [Dev Deps] update eslint, @ljharb/eslint-config, aud, tape a1446bc
  • [meta] use prepublishOnly script for npm 7+ f2dd197
  • [actions] use checkout v3 1ba72f1
  • [Refactor] use a global variable to get the original BigInt instead of a global property a7ccfac
  • [actions] skip npm ls on older nodes 62d31e7

Readme

Source

has-bigints Version Badge

github actions coverage dependency status dev dependency status License Downloads

npm badge

Determine if the JS environment has BigInt support.

Example

var hasBigInts = require('has-bigints');

hasBigInts() === true; // if the environment has native BigInt support. Not polyfillable, not forgeable.

Tests

Simply clone the repo, npm install, and run npm test

Keywords

FAQs

Last updated on 19 Apr 2022

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