https://github.com/puntorigen/easy-jsx-parser
Simple JSX tags parser that returns an easy to read object for every JSX tag
https://github.com/puntorigen/easy-jsx-parser
Last synced: 3 months ago
JSON representation
Simple JSX tags parser that returns an easy to read object for every JSX tag
- Host: GitHub
- URL: https://github.com/puntorigen/easy-jsx-parser
- Owner: puntorigen
- License: mit
- Created: 2023-01-07T18:02:47.000Z (over 2 years ago)
- Default Branch: main
- Last Pushed: 2023-01-17T20:56:44.000Z (over 2 years ago)
- Last Synced: 2025-03-10T23:54:38.083Z (3 months ago)
- Language: JavaScript
- Size: 18.6 KB
- Stars: 0
- Watchers: 1
- Forks: 0
- Open Issues: 1
-
Metadata Files:
- Readme: README.md
- License: LICENSE
Awesome Lists containing this project
README
# easy-jsx-parser
[](https://www.npmjs.com/package/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('My Child');
/*=> '{
Test: {
myProp: true,
children: 'My Child'
}
}'*/
```## Features
* ``: Self-closing JSX tags
* ``: String props
* `` ``: Template props
* ``: True props
* ``: Boolean props
* ``: Number props
* ``: Props with arithmetic, comparison or bitwise operators
* ``: Arrays (with strings, numbers or booleans)
* ``: Objects with string keys and string, number or boolean value
* `<>Test>`: Fragments
* HTML/SVG DOM attributes are converted to correct React equivalent (`class` -> `className`)
* `console.log(data)}>`: Objects with string keys and arrow functions support
* ``: Unlimited nested JSX tags support## License
MIT © [Pablo Schaffner](https://www.github.com/puntorigen)