Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
https://github.com/uetchy/babel-plugin-transform-object-literals
Replace serializable object literals with JSON.parse().
https://github.com/uetchy/babel-plugin-transform-object-literals
babel babel-plugin
Last synced: 2 months ago
JSON representation
Replace serializable object literals with JSON.parse().
- Host: GitHub
- URL: https://github.com/uetchy/babel-plugin-transform-object-literals
- Owner: uetchy
- License: mit
- Created: 2019-06-29T08:08:23.000Z (over 5 years ago)
- Default Branch: master
- Last Pushed: 2023-01-04T02:27:22.000Z (almost 2 years ago)
- Last Synced: 2024-10-07T16:42:32.724Z (3 months ago)
- Topics: babel, babel-plugin
- Language: JavaScript
- Homepage:
- Size: 1.13 MB
- Stars: 12
- Watchers: 2
- Forks: 2
- Open Issues: 20
-
Metadata Files:
- Readme: README.md
- License: LICENSE
Awesome Lists containing this project
README
# Babel Plugin Transform Object Literals
Replace serializable object literals with JSON.parse().
> π Perf tip: if your web app ships large JSON-like configuration as JavaScript object literals, consider using JSON.parse instead. Itβs much faster, especially for cold loads!
> https://twitter.com/mathias/status/1143551692732030979?s=20## Install
```js
npm install --save-dev babel-plugin-transform-object-literals
```Then add `transform-object-literals` to your `.babelrc`:
```json
{
"plugins": ["transform-object-literals"]
}
```## Try
```
cd examples
npm install
npm run build
node ./output.js
```## Contribute
PRs welcome! Make sure `npm test` before making pull-request.
```
git clone https://github.com/uetchy/babel-plugin-transform-object-literals
cd babel-plugin-transform-object-literals
npm install
npm test
```