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
Weekly downloads
30M
decreased by-0.64%
Maintainers
1
Install size
10.9 kB
Created
Weekly downloads
 

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.1 - 2020-12-13

Commits

  • [Tests] use shared travis-ci configs 46a0d6b
  • [Tests] migrate tests to Github Actions 91a38fa
  • [meta] do not publish github action workflow files 69aacba
  • [Dev Deps] update eslint, @ljharb/eslint-config, aud, auto-changelog, tape 64e2c08
  • [Tests] run nyc on all tests; use tape runner 8009375
  • [actions] add automatic rebasing / merge commit blocking e599917
  • [actions] add "Allow Edits" workflow bd0126e
  • [readme] remove travis badge 8e02a73
  • [Dev Deps] update eslint, @ljharb/eslint-config, auto-changelog, safe-publish-latest 95859f2
  • [Dev Deps] update auto-changelog, in-publish, tape 0588f41
  • [Dev Deps] update eslint, @ljharb/eslint-config, tape 5b024a6
  • [meta] add version scripts 4788d61
  • [actions] switch Automatic Rebase workflow to pull_request_target event be0e0de
  • [Dev Deps] update auto-changelog; add aud 13a8d1b
  • [actions] fix action name f873d9a
  • [meta] add funding field 1b51f49
  • [Dev Deps] update auto-changelog 2322461
  • [Tests] only audit prod deps aabdade

Readme

Source

has-bigints Version Badge

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 14 Dec 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