Huge News!Announcing our $40M Series B led by Abstract Ventures.Learn More
Socket
Sign inDemoInstall
Socket

@types/bn.js

Package Overview
Dependencies
Maintainers
0
Versions
14
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

@types/bn.js

TypeScript definitions for bn.js

  • 5.1.6
  • ts4.8
  • ts4.9
  • ts5.0
  • ts5.1
  • ts5.2
  • ts5.3
  • ts5.4
  • ts5.5
  • ts5.6
  • ts5.7
  • ts5.8
  • latest
  • Source
  • npm
  • Socket score

Version published
Maintainers
0
Created

What is @types/bn.js?

@types/bn.js provides TypeScript type definitions for the bn.js library, which is a big number library for arbitrary-precision arithmetic. It is commonly used in cryptographic applications and blockchain development.

What are @types/bn.js's main functionalities?

Basic Arithmetic Operations

This feature allows you to perform basic arithmetic operations such as addition, subtraction, multiplication, and division on big numbers.

const BN = require('bn.js');
const a = new BN(123);
const b = new BN(456);
const sum = a.add(b);
console.log(sum.toString()); // '579'

Modular Arithmetic

This feature allows you to perform modular arithmetic operations, which are essential in cryptographic algorithms.

const BN = require('bn.js');
const a = new BN(10);
const b = new BN(3);
const mod = a.mod(b);
console.log(mod.toString()); // '1'

Bitwise Operations

This feature allows you to perform bitwise operations such as AND, OR, XOR, and NOT on big numbers.

const BN = require('bn.js');
const a = new BN('1010', 2); // binary
const b = new BN('1100', 2); // binary
const and = a.and(b);
console.log(and.toString(2)); // '1000'

Number Conversion

This feature allows you to convert numbers between different bases, such as binary, hexadecimal, and decimal.

const BN = require('bn.js');
const a = new BN('ff', 16); // hexadecimal
console.log(a.toString(10)); // '255'

Other packages similar to @types/bn.js

FAQs

Package last updated on 14 Sep 2024

Did you know?

Socket

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
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc