toon-formatter 1.0.3 → 1.1.1
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 +3 -3
- package/package.json +1 -1
- package/src/utils.js +8 -1
package/README.md
CHANGED
|
@@ -145,8 +145,8 @@ const csvResult = csvToToonSync(csvMixedText);
|
|
|
145
145
|
```
|
|
146
146
|
|
|
147
147
|
**Important Notes:**
|
|
148
|
-
- ✅ **Supports mixed text**: `jsonToToon`, `xmlToToon`, `csvToToon
|
|
149
|
-
- ❌ **Pure data only**: `toonToJson`, `toonToXml`, `toonToCsv`, `toonToYaml`
|
|
148
|
+
- ✅ **Supports mixed text**: `jsonToToon`, `xmlToToon`, `csvToToon`
|
|
149
|
+
- ❌ **Pure data only**: `yamlToToon`, `toonToJson`, `toonToXml`, `toonToCsv`, `toonToYaml`
|
|
150
150
|
|
|
151
151
|
### Using the ToonConverter Class
|
|
152
152
|
|
|
@@ -251,7 +251,7 @@ Mixed text support allows you to convert data that's embedded within regular tex
|
|
|
251
251
|
| `jsonToToon()` | ✅ | ✅ | Extracts all JSON objects/arrays |
|
|
252
252
|
| `xmlToToon()` | ✅ | ✅ | Extracts all XML elements |
|
|
253
253
|
| `csvToToon()` | ✅ | ✅ | Extracts CSV tables |
|
|
254
|
-
| `yamlToToon()` | ✅ |
|
|
254
|
+
| `yamlToToon()` | ✅ | ❌ | Pure YAML only |
|
|
255
255
|
| `toonToJson()` | ✅ | ❌ | Pure TOON only |
|
|
256
256
|
| `toonToXml()` | ✅ | ❌ | Pure TOON only |
|
|
257
257
|
| `toonToCsv()` | ✅ | ❌ | Pure TOON only |
|
package/package.json
CHANGED
package/src/utils.js
CHANGED
|
@@ -232,5 +232,12 @@ export function extractCsvFromString(text) {
|
|
|
232
232
|
resultLines.push(line);
|
|
233
233
|
}
|
|
234
234
|
|
|
235
|
-
|
|
235
|
+
const result = resultLines.join('\n').trim();
|
|
236
|
+
|
|
237
|
+
// Avoid matching TOON arrays (e.g. users[2]{id,name}:)
|
|
238
|
+
if (/^\s*(\w+)?\[\d+\]/.test(result)) {
|
|
239
|
+
return null;
|
|
240
|
+
}
|
|
241
|
+
|
|
242
|
+
return result;
|
|
236
243
|
}
|