@rfanth/tjson 0.3.1 → 0.3.2

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 CHANGED
@@ -12,7 +12,7 @@ Add to your `Cargo.toml`:
12
12
 
13
13
  ```toml
14
14
  [dependencies]
15
- tjson = "0.1"
15
+ tjson = "0.3"
16
16
  ```
17
17
 
18
18
  Install the CLI:
@@ -86,17 +86,34 @@ tjson --canonical -i data.json
86
86
 
87
87
  ## WASM / JavaScript
88
88
 
89
- The library compiles to WebAssembly via [wasm-pack](https://rustwasm.github.io/wasm-pack/):
89
+ Install:
90
90
 
91
91
  ```sh
92
- wasm-pack build --target bundler
92
+ npm install @rfanth/tjson
93
93
  ```
94
94
 
95
+ Usage:
96
+
97
+ ```js
98
+ import { parse, stringify } from '@rfanth/tjson';
99
+
100
+ // Render JSON as TJSON
101
+ const tjson = stringify('{"name":"Alice","scores":[1,2,3]}');
102
+
103
+ // With options (camelCase for WASM/JS only)
104
+ const canonical = stringify('{"name":"Alice"}', { canonical: true });
105
+ const narrow = stringify('{"name":"Alice"}', { wrapWidth: 40, stringArrayStyle: 'preferSpaces' });
106
+
107
+ // Parse TJSON back to a JSON string
108
+ const json = parse(' name: Alice');
109
+ ```
110
+
111
+
95
112
  ## Resources
96
113
 
97
114
  - Website and online demo: [textjson.com](https://textjson.com)
98
- - Specification: _coming soon_
99
- - Test suite: _coming soon_
115
+ - Specification: [tjson-specification.md](https://github.com/rfanth/tjson-spec/blob/master/tjson-specification.md)
116
+ - Test suite: [tjson-tests](https://github.com/rfanth/tjson-tests)
100
117
 
101
118
  ## License
102
119
 
package/package.json CHANGED
@@ -2,7 +2,7 @@
2
2
  "name": "@rfanth/tjson",
3
3
  "type": "module",
4
4
  "description": "Text JSON (TJSON) - a readability optimized, round trip compatible alternative to JSON",
5
- "version": "0.3.1",
5
+ "version": "0.3.2",
6
6
  "license": "BSD-3-Clause",
7
7
  "repository": {
8
8
  "type": "git",
package/tjson_bg.wasm CHANGED
Binary file