项目作者: gtkatakura

项目描述 :
A babel-macro to transpile arithmetic expressions to `decimal.js`
高级语言: JavaScript
项目地址: git://github.com/gtkatakura/decimal.js.macro.git
创建时间: 2018-07-28T02:54:10Z
项目社区:https://github.com/gtkatakura/decimal.js.macro

开源协议:MIT License

下载


decimal.js.macro

Build Status
npm version
MIT License
semantic-release

Usage

  1. import decimal from 'decimal.js.macro'
  2. const a = decimal(1)
  3. const b = decimal(a - 3 * 4 / 5)
  4. const c = decimal(a - 3 + 4 - 5)
  5. const d = decimal(1 ** 2 ** 3)
  6. import { Decimal as _Decimal } from 'decimal.js';
  7. const a = _Decimal('1');
  8. const b = _Decimal(a).sub(_Decimal(_Decimal('3').mul('4')).div('5'));
  9. const c = _Decimal(_Decimal(_Decimal(a).sub('3')).add('4')).sub('5');
  10. const d = _Decimal('1').pow(_Decimal('2').pow('3'));

Contributors

Thanks goes to these wonderful people (emoji key):


gtkatakura

💻 🤔 ⚠️

This project follows the all-contributors specification. Contributions of any kind welcome!