babel-plugin-pre-calculate-number icon indicating copy to clipboard operation
babel-plugin-pre-calculate-number copied to clipboard

pre calculate number expression

Babel-plugin-pre-calculate-number

Build Status Coverage Status Dependency License Prettier Node npm version Size

Before:

const result = 1 + 2 + 3 + 4 + 5;
const area = Math.PI * 2 ** 2;
const oneDaySeconds = 60 * 60 * 24;
const minAge = Math.min(12, 18, 22);

setTimeout(function() {
  // do something
}, 1000 * 2);

After:

const result = 15;
const area = 12.566370614359172;
const oneDaySeconds = 86400;
const minAge = 12;

setTimeout(function() {
  // do something
}, 2000);

Contributors


Axetroy

💻 🔌 ⚠️ 🐛 🎨

License

The MIT License