babel-plugin-transform-currency-operators
An experimental babel plugin for transforming currency.js operators.
Example
In
import currency from 'currency.js';
var currency1 = currency(1.23);
var currency2 = currency1 + 4.56;
var currency3 = currency2 - 4.56;
var currency4 = currency3 * 2;
var currency5 = currency4 / 4;
Out
import currency from 'currency.js';
var currency1 = currency(1.23);
var currency2 = currency1.add(4.56);
var currency3 = currency2.subtract(4.56);
var currency4 = currency3.multiply(2);
var currency5 = currency4.divide(4);
Installation
With npm:
npm install --save-dev babel-plugin-transform-currency-operators
With yarn:
yarn install babel-plugin-transform-currency-operators --dev
Usage
Via .babelrc
(Recommended)
.babelrc
{
"plugins": ["transform-currency-operators"]
}
Via CLI
babel --plugins transform-currency-operators
Via Node API
require("babel-core").transform("code", {
plugins: ["transform-currency-operators"]
});
License
MIT