Skip to content
This repository was archived by the owner on Jan 1, 2023. It is now read-only.

Commit d261d54

Browse files
committed
🔖 release 0.0.9
1 parent 55cd784 commit d261d54

File tree

2 files changed

+22
-2
lines changed

2 files changed

+22
-2
lines changed

README.md

Lines changed: 21 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,27 @@ This repository is inspired by [this article](https://v8.dev/blog/cost-of-javasc
99

1010
> As long as the JSON string is only evaluated once, the JSON.parse approach is much faster compared to the JavaScript object literal, especially for cold loads.
1111
12-
**Caution!!** : I made this plugin for my understanding about AST and babel plugin, so this plugin is not production ready.
12+
## Caution!!
13+
### this plugin may not be production ready
14+
I just made this plugin for my understanding about AST and babel plugin.
15+
16+
### this plugin doesn't support partially JSON expression
17+
18+
I decided not to support partially JSON expression like below.
19+
20+
> Partially JSON expressions such as [notValid, {isValid:true}] ensuring {isValid:true} is transformed.
21+
22+
```
23+
const data = { bar: invalid_object, foo: 'foo' }
24+
25+
const data = { bar: invalid_object, JSON.parse('{"foo": "foo"}')}
26+
```
27+
28+
This is because I think most large objects are not partially JSON expressions. **JSON.parse() is much faster in the case that object is 10 kB or larger. Converting small object to JSON.parse expression is not meaningful.**
29+
30+
### this plugin produces output that only works in modern environments (e.g. Node.js v10+)
31+
32+
I don't care about some backwards compatibilities like [this issues](https://github.com/nd-02110114/babel-plugin-object-to-json-parse/issues/12).
1333

1434
## Object to JSON.parse
1535

package.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
{
22
"name": "babel-plugin-object-to-json-parse",
3-
"version": "0.0.8",
3+
"version": "0.0.9",
44
"main": "dist/index.js",
55
"scripts": {
66
"build": "rm -rf dist/** && tsc",

0 commit comments

Comments
 (0)