Important: This documentation covers Yarn 1 (Classic).
For Yarn 2+ docs and migration guide, see yarnpkg.com.

Package detail

@terra-dev/big-math

Anchor-Protocol43Apache-2.00.20.1TypeScript support: included

Math library for big.js

readme

@terra-dev/big-math

Math library for big.js

API

index.ts

export function min(...numbers: BigSource[]): Big {}

export function max(...numbers: BigSource[]): Big {}

export function floor(number: BigSource): Big {}

Spec

__tests__/big-math.test.ts

import { floor, max, min } from '@terra-dev/big-math';
import big from 'big.js';

describe('big-math', () => {
  test('should get the minimum / maximum numbers', () => {
    expect(min(10, '4', big('8')).toString()).toBe('4');
    expect(max(10, '4', big('8')).toString()).toBe('10');
    expect(floor(big('10.343434')).toString()).toBe('10');
  });
});