Skip to content

Commit 98ed15c

Browse files
Fix .sculptJson when there are empty arrays & Add some research
1 parent a487985 commit 98ed15c

File tree

7 files changed

+1337
-468
lines changed

7 files changed

+1337
-468
lines changed

dist/json-knife.bundle.js

+1-1
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

package.json

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
{
22
"name": "json-knife",
3-
"version": "1.3.0",
3+
"version": "1.3.1",
44
"description": "Bulk set properties recursively in huge, complex and deep JSON string with a robust regular expression based engine",
55
"main": "src/entry.js",
66
"scripts": {

public/index.html

+27-1
Original file line numberDiff line numberDiff line change
@@ -18,8 +18,26 @@
1818
<script class="jsbin" src="http://cdnjs.cloudflare.com/ajax/libs/jquery/3.2.1/jquery.min.js"></script>
1919
<script src="../dist/json-knife.bundle.js"></script>
2020
<script src="sample.js"></script>
21+
<script src="https://cdn.jsdelivr.net/npm/[email protected]/lodash.min.js"></script>
2122
<script type="text/javascript">
2223

24+
var startTime, endTime;
25+
26+
function start() {
27+
startTime = performance.now();
28+
};
29+
30+
function end() {
31+
endTime = performance.now();
32+
var timeDiff = endTime - startTime; //in ms
33+
// strip the ms
34+
//timeDiff /= 1000;
35+
36+
// get seconds
37+
//var seconds = Math.round(timeDiff);
38+
console.log(timeDiff + " m-seconds");
39+
}
40+
2341
let doc = {
2442
"_id" : "5805dfa519f972b200ea2955",
2543
"s" : {
@@ -103,15 +121,23 @@
103121
}
104122

105123
let src = JSON.stringify(JSON.parse(JSON.stringify(original2)));
124+
let src2 = JSON.stringify(JSON.parse(JSON.stringify(original3)));
106125

107126
console.log('Test if original2 is a correct JSON');
108-
console.log(src);
127+
//console.log(src);
109128

110129
/* let re0 = getObjects(original2, 'Mike {[Gentleman]}', 0);
111130
console.log('0 Bulk update - Mike {[Gentleman]} : null');
112131
console.log(JSON.stringify(re0));*/
113132

114133

134+
/* let rex = Pattern.deepCompare('[{"5": false}]', '[{"5": false}]');
135+
console.log(rex);*/
136+
137+
/* start();
138+
let re = Pattern.deepCompare(src, src2);
139+
console.log('re : ' + re);
140+
end();*/
115141
let re1 = Pattern.sculptJson(src, 'Mike {[Gentleman]}', null);
116142
console.log('Bulk update - Mike {[Gentleman]} : null');
117143
console.log(re1);

0 commit comments

Comments
 (0)