# babel-plugin-auto-numeral

> use numeral automatically

Latest version **0.0.1** (published 2019-12-12) · ISC license · 0 weekly downloads

## Install

```sh
npm install babel-plugin-auto-numeral
pnpm add babel-plugin-auto-numeral
yarn add babel-plugin-auto-numeral
bun add babel-plugin-auto-numeral
```

## Health

**Score 15/100 (F)** — status: abandoned.

Positive: no vulnerabilities.

Warnings: low downloads; no types; no esm support; pre 1.0.

Negative: abandoned; low maintenance score.

## Facts

| | |
|---|---|
| Version | 0.0.1 |
| Published | 2019-12-12 |
| First published | 2019-12-11 |
| Weekly downloads | 0 |
| License | ISC |
| TypeScript types | none |
| Module format | CommonJS |
| Dependencies | 1 |
| Unpacked size | 8.6 KB |
| Known vulnerabilities | 0 |
| Install scripts | no |
| GitHub stars | 0 |
| Author | paulhan |
| Maintainers | paulhan |
| Keywords | numeral, ieee754, babel |

## Links

- npm: https://www.npmjs.com/package/babel-plugin-auto-numeral
- Repository: https://github.com/hanzhangyu/babel-plugin-auto-numeral
- Homepage: https://github.com/hanzhangyu/babel-plugin-auto-numeral#readme
- Issues: https://github.com/hanzhangyu/babel-plugin-auto-numeral/issues
- npm.io page: https://npm.io/package/babel-plugin-auto-numeral

## Dependencies (1)

- [@babel/types](https://npm.io/package/@babel/types.md) ^7.7.4

## Alternatives

- [@openai/codex-sdk](https://npm.io/package/@openai/codex-sdk.md) — 731.4K weekly downloads
- [babel-plugin-transform-react-jsx](https://npm.io/package/babel-plugin-transform-react-jsx.md) — 565.0K weekly downloads
- [babel-helper-remove-or-void](https://npm.io/package/babel-helper-remove-or-void.md) — 508.5K weekly downloads
- [@pnpm/store-controller-types](https://npm.io/package/@pnpm/store-controller-types.md) — 186.9K weekly downloads
- [react-native-signature-canvas](https://npm.io/package/react-native-signature-canvas.md) — 155.6K weekly downloads

## Recent versions

- 0.0.1 (latest) — 2019-12-12
- 0.0.1-beta.1 — 2019-12-12
- 0.0.1-beta — 2019-12-11

## README

# babel-plugin-auto-numeral
[![Actions Status][action-img]][action-url]
[![Code coverage][cov-img]][cov-url]
[![Dependency Status][dep-img]][dep-url]
[![Dev Dependency Status][dev-dep-img]][dev-dep-url]
[![NPM version][npm-ver-img]][npm-url]
[![NPM downloads][npm-dl-img]][npm-url]
[![NPM license][npm-lc-img]][npm-url]

## Why?
1. Solving IEE754 by numeral usually takes 3 times of code, this plugin can resolve `+-*/` automatically.
2. Simulated human computing

## Require
babel7

## Install from npm
```bash
npm i -D babel-plugin-auto-numeral
```

## Usage
1\. add babel plugin:
```json
{
    "plugins": [
        ["babel-plugin-auto-numeral",{"precision": 2,"numeralName": "numeral"}]
    ]
}
```
2\. import numeral and use it
```js
import numeral from 'numeral'; // require numeralName first
const a = 1;
console.log(numeral(a + 0.7 * 0.7)); // 1.49
```

### options

key | type | description 
:--- | :--- | :---
precision | number/null/undefined | to pretend human calculate, this option will fix precision after every step
numeralName | string | transform the function named with the numeralName

## ⚠Warn

The expression out of numeral will be not converted, So there is a wrong example:
```js
import numeral from 'numeral';
// wrong
const square = (n) => n * n;
numeral(square(3.3)); // 10.889999999999999

// right
const square = (n) => numeral(n * n);
numeral(square(3.3));

// right
numeral(3.3 * 3.3)
```

[action-img]: https://github.com/hanzhangyu/babel-plugin-auto-numeral/workflows/ci/badge.svg
[action-url]: https://github.com/hanzhangyu/babel-plugin-auto-numeral/actions
[cov-img]: https://img.shields.io/coveralls/hanzhangyu/babel-plugin-auto-numeral.svg?style=flat-square
[cov-url]: https://coveralls.io/github/hanzhangyu/babel-plugin-auto-numeral?branch=master
[dep-img]: https://img.shields.io/david/hanzhangyu/babel-plugin-auto-numeral.svg?style=flat-square
[dep-url]: https://david-dm.org/hanzhangyu/babel-plugin-auto-numeral
[dev-dep-img]: https://img.shields.io/david/dev/hanzhangyu/babel-plugin-auto-numeral.svg?style=flat-square
[dev-dep-url]: https://david-dm.org/hanzhangyu/babel-plugin-auto-numeral#info=devDependencies
[npm-ver-img]: https://img.shields.io/npm/v/babel-plugin-auto-numeral.svg?style=flat-square
[npm-dl-img]: https://img.shields.io/npm/dm/babel-plugin-auto-numeral.svg?style=flat-square
[npm-lc-img]: https://img.shields.io/npm/l/babel-plugin-auto-numeral.svg?style=flat-square
[npm-url]: https://www.npmjs.com/package/babel-plugin-auto-numeral

---
_Source: https://npm.io/package/babel-plugin-auto-numeral · Machine-readable twin of the npm.io package page. Health data is recomputed on every publish._
