seroval 0.4.0 → 0.5.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +2 -2
- package/dist/cjs/development/index.cjs +577 -127
- package/dist/cjs/development/index.cjs.map +4 -4
- package/dist/cjs/production/index.cjs +3 -2
- package/dist/esm/development/index.mjs +577 -127
- package/dist/esm/development/index.mjs.map +4 -4
- package/dist/esm/production/index.mjs +3 -2
- package/dist/types/compat.d.ts +1 -1
- package/dist/types/context.d.ts +2 -0
- package/dist/types/index.d.ts +12 -4
- package/dist/types/quote.d.ts +1 -0
- package/dist/types/tree/deserialize.d.ts +4 -0
- package/dist/types/tree/primitives.d.ts +13 -9
- package/dist/types/tree/shared.d.ts +4 -1
- package/dist/types/tree/symbols.d.ts +33 -0
- package/dist/types/tree/types.d.ts +73 -27
- package/dist/types/types.d.ts +2 -1
- package/package.json +4 -4
- package/src/compat.ts +1 -1
- package/src/context.ts +4 -0
- package/src/index.ts +19 -15
- package/src/quote.ts +12 -1
- package/src/tree/async.ts +30 -16
- package/src/tree/deserialize.ts +288 -0
- package/src/tree/iterator.ts +14 -0
- package/src/tree/primitives.ts +147 -24
- package/src/tree/serialize.ts +55 -19
- package/src/tree/shared.ts +46 -2
- package/src/tree/symbols.ts +65 -0
- package/src/tree/sync.ts +30 -16
- package/src/tree/types.ts +84 -16
- package/src/types.ts +4 -1
package/README.md
CHANGED
|
@@ -139,13 +139,13 @@ console.log(deserialize(serialize(value)) === value);
|
|
|
139
139
|
|
|
140
140
|
`serialize` and `deserialize` is great for server-to-client communication, but what about the other way? `serialize` may cause an [RCE if used as a payload for requests](https://huntr.dev/bounties/63f1ff91-48f3-4886-a179-103f1ddd8ff8). `seroval` includes `toJSON` and `fromJSON` as an alternative form of serialization.
|
|
141
141
|
|
|
142
|
-
First example above outputs the following
|
|
142
|
+
First example above outputs the following JSON
|
|
143
143
|
|
|
144
144
|
```js
|
|
145
145
|
import { toJSON } from 'seroval';
|
|
146
146
|
// ...
|
|
147
147
|
const result = toJSON(object);
|
|
148
|
-
console.log(result);
|
|
148
|
+
console.log(JSON.stringify(result));
|
|
149
149
|
```
|
|
150
150
|
|
|
151
151
|
```json
|