# easy-jsx-parser

> Simple JSX tags parser that returns an easy to read object for every JSX tag

Latest version **0.0.43** (published 2023-01-17) · MIT license · 0 weekly downloads

## Install

```sh
npm install easy-jsx-parser
pnpm add easy-jsx-parser
yarn add easy-jsx-parser
bun add easy-jsx-parser
```

## 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.43 |
| Published | 2023-01-17 |
| First published | 2023-01-07 |
| Weekly downloads | 0 |
| License | MIT |
| TypeScript types | bundled |
| Module format | CommonJS |
| Node | >=16 |
| Dependencies | 6 |
| Unpacked size | 24.9 KB |
| Known vulnerabilities | 0 |
| Install scripts | no |
| GitHub stars | 0 |
| Author | Pablo Schaffner |
| Maintainers | pabloschaffner |
| Keywords | jsx, convert, object, concepto, react, ast |

## Links

- npm: https://www.npmjs.com/package/easy-jsx-parser
- Repository: https://github.com/puntorigen/easy-jsx-parser
- Homepage: https://github.com/puntorigen/easy-jsx-parser#readme
- Issues: https://github.com/puntorigen/easy-jsx-parser/issues
- npm.io page: https://npm.io/package/easy-jsx-parser

## Dependencies (6)

- [acorn](https://npm.io/package/acorn.md) 8.8.1
- [acorn-jsx](https://npm.io/package/acorn-jsx.md) *
- [is-string](https://npm.io/package/is-string.md) ^1.0.5
- [svg-tag-names](https://npm.io/package/svg-tag-names.md) ^2.0.1
- [html-tag-names](https://npm.io/package/html-tag-names.md) ^1.1.5
- [style-to-object](https://npm.io/package/style-to-object.md) ^0.3.0

## Alternatives

- [mobx-react](https://npm.io/package/mobx-react.md) — 2.8M weekly downloads
- [rc-tree](https://npm.io/package/rc-tree.md) — 2.6M weekly downloads
- [@react-oauth/google](https://npm.io/package/@react-oauth/google.md) — 1.3M weekly downloads
- [@wagmi/connectors](https://npm.io/package/@wagmi/connectors.md) — 877.0K weekly downloads
- [vee-validate](https://npm.io/package/vee-validate.md) — 836.4K weekly downloads

## Recent versions

- 0.0.43 (latest) — 2023-01-17
- 0.0.42 — 2023-01-07
- 0.0.41 — 2023-01-07
- 0.0.4 — 2023-01-07
- 0.0.3 — 2023-01-07
- 0.0.2 — 2023-01-07

## README

# easy-jsx-parser

[![npm version](https://img.shields.io/npm/v/easy-jsx-parser)](https://www.npmjs.com/package/easy-jsx-parser) ![npm downloads](https://img.shields.io/npm/dm/easy-jsx-parser)

> Simple JSX tags parser that returns an easy to read object for every JSX tag

## Install

```
$ npm i easy-jsx-parser
```

## Usage

```js
const jsxToObj = require('easy-jsx-parser');

jsxToObj('<Test myProp={true}>My Child</Test>');
/*=> '{ 
    Test: {
        myProp: true,
        children: 'My Child'
    }
}'*/
```

## Features

* `<Test />`: Self-closing JSX tags
* `<Test myProp="string">`: String props
* `` <Test myProp={`string`}> ``: Template props
* `<Test myProp>`: True props
* `<Test myProp={false}>`: Boolean props
* `<Test myProp={34}>`: Number props
* `<Test myProp={3 + 3 + 3}>`: Props with arithmetic, comparison or bitwise operators
* `<Test myProp={['Test', true, 34]}>`: Arrays (with strings, numbers or booleans)
* `<Test myProp={{ test: 34 }}>`: Objects with string keys and string, number or boolean value
* `<>Test</>`: Fragments
* HTML/SVG DOM attributes are converted to correct React equivalent (`class` -> `className`)
* `<Test myProp={(data)=>console.log(data)}>`: Objects with string keys and arrow functions support
* `<Nested><Child></Child></Nested>`: Unlimited nested JSX tags support

## License

MIT © [Pablo Schaffner](https://www.github.com/puntorigen)

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