https://github.com/guoyunhe/bigdash
re-implement lodash number functions with big.js
https://github.com/guoyunhe/bigdash
big decimal lodash number
Last synced: 7 months ago
JSON representation
re-implement lodash number functions with big.js
- Host: GitHub
- URL: https://github.com/guoyunhe/bigdash
- Owner: guoyunhe
- License: mpl-2.0
- Created: 2022-09-14T05:51:28.000Z (almost 4 years ago)
- Default Branch: main
- Last Pushed: 2025-07-12T12:04:12.000Z (11 months ago)
- Last Synced: 2025-08-14T04:00:09.694Z (10 months ago)
- Topics: big, decimal, lodash, number
- Language: TypeScript
- Homepage: https://guoyunhe.github.io/bigdash/
- Size: 50.8 KB
- Stars: 1
- Watchers: 2
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
- Changelog: CHANGELOG.md
- License: LICENSE
Awesome Lists containing this project
README
# bigdash




Re-implement lodash math functions with [big.js](https://github.com/MikeMcl/big.js).
## Why?
Lodash:
```js
sum([0.1, 0.2]); // 0.30000000000000004
```
Bigdash:
```js
sum([0.1, 0.2]); // 0.3
```
[Learn more...](https://0.30000000000000004.com/)
## Install
```bash
npm install --save bigdash
```
## Usage
### add()
```js
import { add } from 'bigdash';
add(0.1, 0.2); // 0.3
```
### divide()
```js
import { divide } from 'bigdash';
divide(0.1, 0.2); // 0.5
```
### mean()
```js
import { mean } from 'bigdash';
mean([0.1, 0.2]); // 0.15
```
### meanBy()
```js
import { meanBy } from 'bigdash';
meanBy([{ foo: { bar: 0.1 } }, { foo: { bar: 0.2 } }], 'foo.bar'); // 0.15
meanBy([{ foo: { bar: 0.1 } }, { foo: { bar: 0.2 } }], ['foo', 'bar']); // 0.15
meanBy([{ foo: { bar: 0.1 } }, { foo: { bar: 0.2 } }], (item) => item.foo.bar); // 0.15
```
### multiply()
```js
import { multiply } from 'bigdash';
multiply(0.1, 0.2); // 0.02
```
### subtract()
```js
import { subtract } from 'bigdash';
subtract(0.3, 0.2); // 0.1
```
### sum()
```js
import { sum } from 'bigdash';
sum([0.1, 0.2]); // 0.3
```
### sumBy()
```js
import { sumBy } from 'bigdash';
sumBy([{ foo: { bar: 0.1 } }, { foo: { bar: 0.2 } }], 'foo.bar'); // 0.3
sumBy([{ foo: { bar: 0.1 } }, { foo: { bar: 0.2 } }], ['foo', 'bar']); // 0.3
sumBy([{ foo: { bar: 0.1 } }, { foo: { bar: 0.2 } }], (item) => item.foo.bar); // 0.3
```