@durhailay/bigint-utils
Advanced tools
Comparing version 0.0.1 to 0.0.2
{ | ||
"name": "@durhailay/bigint-utils", | ||
"version": "0.0.1", | ||
"version": "0.0.2", | ||
"description": "Utilities to handle bigints in web3 applications.", | ||
@@ -5,0 +5,0 @@ "main": "dist/index.js", |
# bigint-utils | ||
A super lightweight library to handle bigints in web3 applications. | ||
## Installation | ||
```bash | ||
npm install @durhailay/bigint-utils | ||
``` | ||
## Usage | ||
```typescript | ||
import { BigNumber } from '@durhailay/bigint-utils' | ||
const bn = new BigNumber(1234567891011123456789n, 18) | ||
``` | ||
### Multiplication | ||
```typescript | ||
const result = bn.mul(2n) | ||
``` | ||
### Division | ||
```typescript | ||
const result = bn.div(123456789n) | ||
``` | ||
### Get the value | ||
```typescript | ||
const value = bn.value | ||
``` | ||
### Get the decimals | ||
```typescript | ||
const decimals = bn.decimals | ||
``` | ||
### toNumber | ||
```typescript | ||
const number = bn.toNumber() | ||
// 123456789.1011123456789 | ||
``` |
1588
50