jsonc-effect 0.1.0 → 0.2.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 +17 -0
- package/index.d.ts +1375 -143
- package/index.js +410 -380
- package/package.json +1 -1
package/README.md
CHANGED
|
@@ -12,6 +12,7 @@ Pure [Effect](https://effect.website) JSONC (JSON with Comments) parser with no
|
|
|
12
12
|
- **Zero parser dependencies** -- `effect` is the sole runtime dependency
|
|
13
13
|
- **Schema integration** -- parse JSONC strings directly into validated types
|
|
14
14
|
- **Full toolchain** -- scanner, parser, AST navigation, visitor stream, formatting, and modification
|
|
15
|
+
- **Equality comparisons** -- compare JSONC documents semantically, ignoring comments, formatting, and key ordering
|
|
15
16
|
- **Safe by default** -- returns `unknown` (not `any`) and `Option` (not `undefined`)
|
|
16
17
|
|
|
17
18
|
## Installation
|
|
@@ -32,6 +33,22 @@ const result = Effect.runSync(
|
|
|
32
33
|
// => { key: 42 }
|
|
33
34
|
```
|
|
34
35
|
|
|
36
|
+
Semantically compare two JSONC documents:
|
|
37
|
+
|
|
38
|
+
```typescript
|
|
39
|
+
import { equals } from "jsonc-effect"
|
|
40
|
+
import { Effect } from "effect"
|
|
41
|
+
|
|
42
|
+
// Semantically equal despite different formatting, comments, and key order
|
|
43
|
+
const same = Effect.runSync(
|
|
44
|
+
equals(
|
|
45
|
+
'{ "foo": 1, "bar": 2 }',
|
|
46
|
+
'{ "bar": 2, /* comment */ "foo": 1 }'
|
|
47
|
+
)
|
|
48
|
+
)
|
|
49
|
+
// => true
|
|
50
|
+
```
|
|
51
|
+
|
|
35
52
|
## FAQ
|
|
36
53
|
|
|
37
54
|
### Why does this module exist?
|