toon-formatter 2.3.0 → 2.3.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/CHANGELOG.md +7 -0
- package/package.json +1 -1
- package/src/utils.js +5 -2
- package/toon-formatter-2.3.1.tgz +0 -0
package/CHANGELOG.md
CHANGED
|
@@ -4,6 +4,13 @@ All notable changes to this project will be documented in this file.
|
|
|
4
4
|
|
|
5
5
|
The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/),
|
|
6
6
|
and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0.html).
|
|
7
|
+
## [2.3.1] - 2026-02-01
|
|
8
|
+
|
|
9
|
+
### Changed
|
|
10
|
+
- **Bug Fixes**
|
|
11
|
+
- Extracting json from string stuck in infinite loop while dealing with toon array like: [2]{"a","b"}..
|
|
12
|
+
- Code blocks extractor also fetching json data by confusing it with coding arrays
|
|
13
|
+
|
|
7
14
|
## [2.3.0] - 2026-01-27
|
|
8
15
|
|
|
9
16
|
### Added
|
package/package.json
CHANGED
package/src/utils.js
CHANGED
|
@@ -125,7 +125,10 @@ export function extractJsonFromString(text) {
|
|
|
125
125
|
if (text[i] === '{' || text[i] === '[') {
|
|
126
126
|
// Ignore if preceded by non-whitespace (e.g. key[2]),
|
|
127
127
|
// unless it's a closing bracket/brace or XML tag end
|
|
128
|
-
|
|
128
|
+
const relativeIndex = text.slice(i).search(/\]{/);
|
|
129
|
+
if (relativeIndex !== -1 && /^\[\d*$/.test(text.slice(i, i + relativeIndex))) {
|
|
130
|
+
continue;
|
|
131
|
+
} else if (i > 0 && /\S/.test(text[i - 1]) && !/[\}\]>]/.test(text[i - 1])) {
|
|
129
132
|
continue;
|
|
130
133
|
}
|
|
131
134
|
startIndex = i;
|
|
@@ -471,7 +474,7 @@ export function isCode(value) {
|
|
|
471
474
|
|
|
472
475
|
// Multi-line code detection
|
|
473
476
|
const hasMultipleLines = /\n/.test(trimmed);
|
|
474
|
-
const hasCodePatterns = /import|require\(|function |const |let |var |class |def |async
|
|
477
|
+
const hasCodePatterns = /import|require\(|function |const |let |var |class |def |async |=>|;|print\(|console\.log\(/.test(trimmed);
|
|
475
478
|
const startsWithShebang = trimmed.startsWith('#!');
|
|
476
479
|
|
|
477
480
|
return hasMultipleLines && (hasCodePatterns || startsWithShebang);
|
|
Binary file
|