1.3.0 • Published 2 years ago

bigdash v1.3.0

Weekly downloads
-
License
GPL-3.0
Repository
github
Last release
2 years ago

Bigdash

Re-implement lodash math functions with big.js.

Why?

Lodash:

sum([0.1, 0.2]); // 0.30000000000000004

Bigdash:

sum([0.1, 0.2]); // 0.3

Learn more...

Install

npm install --save bigdash

Usage

add()

import { add } from 'bigdash';

add(0.1, 0.2); // 0.3

divide()

import { divide } from 'bigdash';

divide(0.1, 0.2); // 0.5

mean()

import { mean } from 'bigdash';

mean([0.1, 0.2]); // 0.15

meanBy()

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()

import { multiply } from 'bigdash';

multiply(0.1, 0.2); // 0.02

subtract()

import { subtract } from 'bigdash';

subtract(0.3, 0.2); // 0.1

sum()

import { sum } from 'bigdash';

sum([0.1, 0.2]); // 0.3

sumBy()

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
1.3.0

2 years ago

1.2.2

2 years ago

1.2.1

2 years ago

1.2.0

2 years ago

1.1.0

2 years ago

1.0.0

2 years ago