# compile-expression

> Compile javascript expressions (including jsx), producing javascript values

Latest version **0.0.4** (published 2022-04-06) · MIT license · 0 weekly downloads

## Install

```sh
npm install compile-expression
pnpm add compile-expression
yarn add compile-expression
bun add compile-expression
```

## Health

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

Positive: has types; no vulnerabilities; high quality score.

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

Negative: abandoned; low maintenance score.

## Facts

| | |
|---|---|
| Version | 0.0.4 |
| Published | 2022-04-06 |
| First published | 2022-04-03 |
| Weekly downloads | 0 |
| License | MIT |
| TypeScript types | bundled |
| Module format | CommonJS |
| Node | >= 10.8.0 |
| Dependencies | 4 |
| Unpacked size | 6.8 KB |
| Known vulnerabilities | 0 |
| Install scripts | no |
| GitHub stars | 0 |
| Author | peakchen90 |
| Maintainers | peakchen90 |

## Links

- npm: https://www.npmjs.com/package/compile-expression
- Repository: https://github.com/peakchen90/compile-expression
- Homepage: https://github.com/peakchen90/compile-expression#readme
- Issues: https://github.com/peakchen90/compile-expression/issues
- npm.io page: https://npm.io/package/compile-expression

## Dependencies (4)

- [acorn](https://npm.io/package/acorn.md) ^8.7.0
- [astring](https://npm.io/package/astring.md) ^1.8.1
- [acorn-jsx](https://npm.io/package/acorn-jsx.md) ^5.3.2
- [acorn-walk](https://npm.io/package/acorn-walk.md) ^8.2.0

## Recent versions

- 0.0.4 (latest) — 2022-04-06
- 0.0.3 — 2022-04-03
- 0.0.2 — 2022-04-03
- 0.0.1 — 2022-04-03
- 0.0.1-beta.0 — 2022-04-03

## README

# compile-expression

Compile javascript expressions (including jsx), producing javascript values

## Environment

- Node: `>= 10.8.0`
- Browser: Not support

## Install

```bash
npm i -S compile-expression
```

## Usage

```js
const {compileExpression} = require('compile-expression');

compileExpression('1 + 2');
// 3

compileExpression('foo.toFixed(2)', { foo: 5 });
// "5.00"

compileExpression('<div>foo</div>', { React: require('react') });
// {
//   '$$typeof': Symbol(react.element),
//   type: 'div',
//   key: null,
//   ref: null,
//   props: { children: 'foo' },
//   _owner: null,
//   _store: {}
// }
```

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