Skip to content

Commit 26415fa

Browse files
committed
Temp fix (Maybe Rebase)
1 parent dd2ed01 commit 26415fa

File tree

4 files changed

+14
-6
lines changed

4 files changed

+14
-6
lines changed

main.js

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -5,6 +5,10 @@ import { validateRe } from './src/modules/regex/rgx.js'
55
console.time()
66
const result = valueParser(data)
77
console.timeEnd()
8+
if (result.length !== 2) {
9+
console.log(result)
10+
}
11+
812
if (result) {
913
const test = validateRe.test(result[1])
1014
test

src/assets/test.json

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
{"yesy": {
2+
"h": {
3+
"d": [[],[], null]
4+
}
5+
}}

src/modules/parsers/object.js

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -24,9 +24,7 @@ export const object = str => {
2424
let factory
2525
try {
2626
factory = stringx(str)
27-
} catch (error) {
28-
console.log(error)
29-
}
27+
} catch (error) {}
3028
space(str) ? (str = space(str)[1]) : str
3129
factory[1] = syntaxCheck3(factory[1])
3230
if (factory) {

src/modules/parsers/string.js

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -4,12 +4,13 @@ export const stringx = str => {
44
let match
55
return str.startsWith('"')
66
? ((match = str.match(stringRe)),
7-
match[0] != undefined
8-
? [stringEnhancer(match[0].slice(1, -1)), str.replace(match[0], '')]
9-
: null)
7+
match && match[0] != undefined
8+
? [stringEnhancer(match[0]), str.replace(match[0], '')]
9+
: SyntaxError('Syntax Error'))
1010
: null
1111
}
1212
const stringEnhancer = str => {
13+
str = str.slice(1, -1)
1314
for (const key in regexTable) {
1415
str = str.replace(new RegExp(key, 'g'), regexTable[key])
1516
}

0 commit comments

Comments
 (0)