Skip to content

Latest commit

 

History

History
73 lines (54 loc) · 3.03 KB

File metadata and controls

73 lines (54 loc) · 3.03 KB

@rc-component/mini-decimal

Ant Design Part of the Ant Design ecosystem.

🧮 Small decimal calculator for precise string-based arithmetic.

NPM version npm downloads build status Codecov bundle size dumi

English | 简体中文

Highlights

Area Support
Purpose Small decimal calculator for precise string-based arithmetic.
Package @rc-component/mini-decimal
Release @rc-component/np / rc-np

Install

npm install @rc-component/mini-decimal

Usage

import getMiniDecimal from '@rc-component/mini-decimal';

getMiniDecimal('0.1').add('0.2').toString(); // 0.3
getMiniDecimal('0.1').multi('0.2').toString(); // 0.02

API

Method Description
add(value) Add another decimal value.
multi(value) Multiply by another decimal value.
negate() Return the negated value.
equal(value) Check equality.
lessEquals(value) Check whether the current value is less than or equal to another decimal value.

Development

npm install
npm test
npm run lint
npm run tsc
npm run compile

The dumi site runs at http://localhost:8000.

Release

npm run prepublishOnly

The release flow is handled by @rc-component/np through the rc-np command when the package uses the shared release flow.

License

@rc-component/mini-decimal is released under the MIT license.