Skip to content

Commit 7658580

Browse files
author
andrew85
committed
Change the regex of keyType simpler
1 parent 697ab50 commit 7658580

File tree

5 files changed

+9
-8
lines changed

5 files changed

+9
-8
lines changed

LICENSE

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
MIT License
22

3-
Copyright (c) 2018 Andrew-Kang-G
3+
Copyright (c) 2019 Andrew-Kang-G
44

55
Permission is hereby granted, free of charge, to any person obtaining a copy
66
of this software and associated documentation files (the "Software"), to deal

dist/json-knife.bundle.js

Lines changed: 1 addition & 1 deletion
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

package.json

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
{
22
"name": "json-knife",
3-
"version": "1.0.1",
4-
"description": "Mass update certain key-values recursively in huge, complex JSON string trees without using JSON.parse() & self-calling function.",
3+
"version": "1.1.0",
4+
"description": "Mass update certain key-values recursively in huge, complex JSON string trees with a robust regular expression engine, which means this does not call JSON.parse().",
55
"main": "src/entry.js",
66
"scripts": {
77
"build": "gulp",

public/index.html

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -92,7 +92,7 @@
9292
}
9393
}]
9494
}],
95-
"Judy": [{
95+
"Queen": [{
9696
"associatedDrug": [{
9797
"name": "asprin",
9898
"dose": "",

src/pattern.js

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -22,7 +22,8 @@ const jsonBase = {
2222
commons.spaceOrNot;
2323
},
2424

25-
keyType: '"((?:[^"]*?[^\\u005C])|(?:(?=[^"]*[\\u005C]").*?[^\\u005C]))"',
25+
keyType : '"((?:[^"\\\\]|\\\\"|\\\\[^"])*)"',
26+
//keyType: '"((?:[^"]*?[^\\u005C])|(?:(?=[^"]*[\\u005C]").*?[^\\u005C]))"',
2627

2728
valueType: {
2829
// 2
@@ -38,7 +39,7 @@ const jsonBase = {
3839
// 7
3940
empty: '(null)',
4041

41-
// 2
42+
/* // 2
4243
astring: '(?:".*?[^\\u005C\\u0022]"|"")',
4344
// 3
4445
anumber: '(?:[-+]?(?:\\d+\\.?\\d*|\\d*\.?\\d+)(?:[Ee][-+]?[0-2]?\\d{1,2})?)',
@@ -49,7 +50,7 @@ const jsonBase = {
4950
// 6
5051
aarray: '(?:\\[)',
5152
// 7
52-
aempty: '(?:null)',
53+
aempty: '(?:null)',*/
5354
},
5455

5556
}

0 commit comments

Comments
 (0)