How to use the min function from bignumber.js

Find comprehensive JavaScript bignumber.js.min code examples handpicked from public code repositorys.

236
237
238
239
240
241
242
243
244
245
const tokenAPercentIncrease = amountA.mul(totalSupply).div(reserve0);
const tokenBPercentIncrease = amountB.mul(totalSupply).div(reserve1);

const bnTokenAPercentIncrease = new BigNumber(ethers.utils.formatUnits(tokenAPercentIncrease));
const bnTokenBPercentIncrease = new BigNumber(ethers.utils.formatUnits(tokenBPercentIncrease));
const minimum = BigNumber.min(bnTokenAPercentIncrease, bnTokenBPercentIncrease);
const formattedMininum = minimum.toFormat();
const formattedLiquidity = ethers.utils.formatUnits(liquidity);

expect(formattedLiquidity).to.equal(formattedMininum);
fork icon0
star icon1
watch icon0

+ 3 other calls in file

551
552
553
554
555
556
557
558
559
560
	logger.debug('PP> totalSent = %s', totalSent.toString(10));
	var address = worker.address = (worker.address || getProperAddress(w));              
	logger.debug('PP> address = %s', address);
	worker.sent = addressAmounts[address] = toSend;
	logger.debug('PP> worker.sent = %s', worker.sent.toString(10));
	worker.balanceChange = BigNumber.min(worker.balance, worker.sent).multipliedBy(new BigNumber(-1));
	logger.debug('PP> worker.balanceChange = %s', worker.balanceChange.toString(10));
} else {
	logger.debug('PP> Worker %s have not reached minimum payout threshold %s', w, minPayment.toString(10));
	worker.balanceChange = BigNumber.max(toSend.minus(worker.balance), new BigNumber(0));
fork icon0
star icon0
watch icon0

+ 3 other calls in file