Huge News!Announcing our $40M Series B led by Abstract Ventures.Learn More
Socket
Sign inDemoInstall
Socket

json-diff-kit

Package Overview
Dependencies
Maintainers
1
Versions
29
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

json-diff-kit - npm Package Compare versions

Comparing version 1.0.6 to 1.0.7

typings/utils/get-segments.d.ts

6

coverage/coverage-final.json

@@ -1,5 +0,5 @@

{"D:\\Workspace\\json-diff-kit\\src\\utils\\format-value.ts": {"path":"D:\\Workspace\\json-diff-kit\\src\\utils\\format-value.ts","statementMap":{"0":{"start":{"line":1,"column":0},"end":{"line":1,"column":22}},"1":{"start":{"line":1,"column":22},"end":{"line":1,"column":null}},"2":{"start":{"line":3,"column":20},"end":{"line":13,"column":null}},"3":{"start":{"line":4,"column":2},"end":{"line":5,"column":null}},"4":{"start":{"line":5,"column":4},"end":{"line":5,"column":null}},"5":{"start":{"line":7,"column":2},"end":{"line":8,"column":null}},"6":{"start":{"line":8,"column":4},"end":{"line":8,"column":null}},"7":{"start":{"line":10,"column":2},"end":{"line":11,"column":null}},"8":{"start":{"line":11,"column":4},"end":{"line":11,"column":null}},"9":{"start":{"line":13,"column":2},"end":{"line":13,"column":null}},"10":{"start":{"line":16,"column":15},"end":{"line":16,"column":null}}},"fnMap":{"0":{"name":"(anonymous_8)","decl":{"start":{"line":1,"column":0},"end":{"line":1,"column":22}},"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":22}}},"1":{"name":"(anonymous_9)","decl":{"start":{"line":3,"column":20},"end":{"line":3,"column":21}},"loc":{"start":{"line":3,"column":54},"end":{"line":13,"column":null}}}},"branchMap":{"0":{"loc":{"start":{"line":3,"column":33},"end":{"line":3,"column":54}},"type":"default-arg","locations":[{"start":{"line":3,"column":41},"end":{"line":3,"column":54}}]},"1":{"loc":{"start":{"line":4,"column":2},"end":{"line":5,"column":null}},"type":"if","locations":[{"start":{"line":4,"column":2},"end":{"line":5,"column":null}}]},"2":{"loc":{"start":{"line":4,"column":6},"end":{"line":4,"column":45}},"type":"binary-expr","locations":[{"start":{"line":4,"column":6},"end":{"line":4,"column":29}},{"start":{"line":4,"column":29},"end":{"line":4,"column":45}}]},"3":{"loc":{"start":{"line":7,"column":2},"end":{"line":8,"column":null}},"type":"if","locations":[{"start":{"line":7,"column":2},"end":{"line":8,"column":null}}]},"4":{"loc":{"start":{"line":7,"column":6},"end":{"line":7,"column":57}},"type":"binary-expr","locations":[{"start":{"line":7,"column":6},"end":{"line":7,"column":30}},{"start":{"line":7,"column":30},"end":{"line":7,"column":57}}]},"5":{"loc":{"start":{"line":10,"column":2},"end":{"line":11,"column":null}},"type":"if","locations":[{"start":{"line":10,"column":2},"end":{"line":11,"column":null}}]}},"s":{"0":9,"1":1,"2":1,"3":7,"4":2,"5":5,"6":2,"7":3,"8":1,"9":2,"10":1},"f":{"0":7,"1":7},"b":{"0":[7],"1":[2],"2":[7,6],"3":[2],"4":[5,4],"5":[1]}}
{"D:\\Workspace\\json-diff-kit\\src\\utils\\format-value.ts": {"path":"D:\\Workspace\\json-diff-kit\\src\\utils\\format-value.ts","statementMap":{"0":{"start":{"line":1,"column":0},"end":{"line":1,"column":22}},"1":{"start":{"line":1,"column":22},"end":{"line":1,"column":null}},"2":{"start":{"line":3,"column":20},"end":{"line":13,"column":null}},"3":{"start":{"line":4,"column":2},"end":{"line":5,"column":null}},"4":{"start":{"line":5,"column":4},"end":{"line":5,"column":null}},"5":{"start":{"line":7,"column":2},"end":{"line":8,"column":null}},"6":{"start":{"line":8,"column":4},"end":{"line":8,"column":null}},"7":{"start":{"line":10,"column":2},"end":{"line":11,"column":null}},"8":{"start":{"line":11,"column":4},"end":{"line":11,"column":null}},"9":{"start":{"line":13,"column":2},"end":{"line":13,"column":null}},"10":{"start":{"line":16,"column":15},"end":{"line":16,"column":null}}},"fnMap":{"0":{"name":"(anonymous_8)","decl":{"start":{"line":1,"column":0},"end":{"line":1,"column":22}},"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":22}}},"1":{"name":"(anonymous_9)","decl":{"start":{"line":3,"column":20},"end":{"line":3,"column":21}},"loc":{"start":{"line":3,"column":54},"end":{"line":13,"column":null}}}},"branchMap":{"0":{"loc":{"start":{"line":3,"column":33},"end":{"line":3,"column":54}},"type":"default-arg","locations":[{"start":{"line":3,"column":41},"end":{"line":3,"column":54}}]},"1":{"loc":{"start":{"line":4,"column":2},"end":{"line":5,"column":null}},"type":"if","locations":[{"start":{"line":4,"column":2},"end":{"line":5,"column":null}}]},"2":{"loc":{"start":{"line":4,"column":6},"end":{"line":4,"column":45}},"type":"binary-expr","locations":[{"start":{"line":4,"column":6},"end":{"line":4,"column":29}},{"start":{"line":4,"column":29},"end":{"line":4,"column":45}}]},"3":{"loc":{"start":{"line":7,"column":2},"end":{"line":8,"column":null}},"type":"if","locations":[{"start":{"line":7,"column":2},"end":{"line":8,"column":null}}]},"4":{"loc":{"start":{"line":7,"column":6},"end":{"line":7,"column":57}},"type":"binary-expr","locations":[{"start":{"line":7,"column":6},"end":{"line":7,"column":30}},{"start":{"line":7,"column":30},"end":{"line":7,"column":57}}]},"5":{"loc":{"start":{"line":10,"column":2},"end":{"line":11,"column":null}},"type":"if","locations":[{"start":{"line":10,"column":2},"end":{"line":11,"column":null}}]}},"s":{"0":11,"1":1,"2":1,"3":9,"4":2,"5":7,"6":2,"7":5,"8":3,"9":2,"10":1},"f":{"0":9,"1":9},"b":{"0":[9],"1":[2],"2":[9,8],"3":[2],"4":[7,6],"5":[3]}}
,"D:\\Workspace\\json-diff-kit\\src\\utils\\get-type.ts": {"path":"D:\\Workspace\\json-diff-kit\\src\\utils\\get-type.ts","statementMap":{"0":{"start":{"line":1,"column":0},"end":{"line":1,"column":6}},"1":{"start":{"line":1,"column":16},"end":{"line":8,"column":null}},"2":{"start":{"line":2,"column":2},"end":{"line":3,"column":null}},"3":{"start":{"line":3,"column":4},"end":{"line":3,"column":null}},"4":{"start":{"line":5,"column":2},"end":{"line":6,"column":null}},"5":{"start":{"line":6,"column":4},"end":{"line":6,"column":null}},"6":{"start":{"line":8,"column":2},"end":{"line":8,"column":null}},"7":{"start":{"line":11,"column":15},"end":{"line":11,"column":null}}},"fnMap":{"0":{"name":"(anonymous_6)","decl":{"start":{"line":1,"column":0},"end":{"line":1,"column":6}},"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":6}}},"1":{"name":"(anonymous_7)","decl":{"start":{"line":1,"column":16},"end":{"line":1,"column":17}},"loc":{"start":{"line":1,"column":32},"end":{"line":8,"column":null}}}},"branchMap":{"0":{"loc":{"start":{"line":2,"column":2},"end":{"line":3,"column":null}},"type":"if","locations":[{"start":{"line":2,"column":2},"end":{"line":3,"column":null}}]},"1":{"loc":{"start":{"line":5,"column":2},"end":{"line":6,"column":null}},"type":"if","locations":[{"start":{"line":5,"column":2},"end":{"line":6,"column":null}}]}},"s":{"0":8,"1":1,"2":6,"3":1,"4":5,"5":1,"6":4,"7":1},"f":{"0":6,"1":6},"b":{"0":[1],"1":[1]}}
,"D:\\Workspace\\json-diff-kit\\src\\utils\\sort-inner-arrays.ts": {"path":"D:\\Workspace\\json-diff-kit\\src\\utils\\sort-inner-arrays.ts","statementMap":{"0":{"start":{"line":1,"column":0},"end":{"line":1,"column":6}},"1":{"start":{"line":1,"column":23},"end":{"line":18,"column":null}},"2":{"start":{"line":2,"column":2},"end":{"line":3,"column":null}},"3":{"start":{"line":3,"column":4},"end":{"line":3,"column":null}},"4":{"start":{"line":5,"column":2},"end":{"line":6,"column":null}},"5":{"start":{"line":6,"column":4},"end":{"line":6,"column":null}},"6":{"start":{"line":8,"column":2},"end":{"line":9,"column":null}},"7":{"start":{"line":9,"column":4},"end":{"line":9,"column":null}},"8":{"start":{"line":11,"column":2},"end":{"line":12,"column":null}},"9":{"start":{"line":12,"column":4},"end":{"line":12,"column":null}},"10":{"start":{"line":14,"column":2},"end":{"line":15,"column":null}},"11":{"start":{"line":15,"column":4},"end":{"line":15,"column":null}},"12":{"start":{"line":17,"column":2},"end":{"line":18,"column":null}},"13":{"start":{"line":18,"column":4},"end":{"line":18,"column":null}},"14":{"start":{"line":29,"column":12},"end":{"line":47,"column":null}},"15":{"start":{"line":30,"column":23},"end":{"line":30,"column":null}},"16":{"start":{"line":31,"column":23},"end":{"line":31,"column":null}},"17":{"start":{"line":33,"column":2},"end":{"line":34,"column":null}},"18":{"start":{"line":34,"column":4},"end":{"line":34,"column":null}},"19":{"start":{"line":37,"column":2},"end":{"line":38,"column":null}},"20":{"start":{"line":38,"column":4},"end":{"line":38,"column":null}},"21":{"start":{"line":41,"column":2},"end":{"line":47,"column":null}},"22":{"start":{"line":43,"column":6},"end":{"line":43,"column":null}},"23":{"start":{"line":45,"column":6},"end":{"line":45,"column":null}},"24":{"start":{"line":47,"column":6},"end":{"line":47,"column":null}},"25":{"start":{"line":51,"column":24},"end":{"line":66,"column":null}},"26":{"start":{"line":52,"column":2},"end":{"line":53,"column":null}},"27":{"start":{"line":53,"column":4},"end":{"line":53,"column":null}},"28":{"start":{"line":56,"column":2},"end":{"line":59,"column":null}},"29":{"start":{"line":57,"column":19},"end":{"line":57,"column":null}},"30":{"start":{"line":58,"column":4},"end":{"line":58,"column":null}},"31":{"start":{"line":58,"column":26},"end":{"line":58,"column":null}},"32":{"start":{"line":59,"column":4},"end":{"line":59,"column":null}},"33":{"start":{"line":59,"column":30},"end":{"line":59,"column":null}},"34":{"start":{"line":62,"column":17},"end":{"line":62,"column":null}},"35":{"start":{"line":63,"column":2},"end":{"line":64,"column":null}},"36":{"start":{"line":64,"column":4},"end":{"line":64,"column":null}},"37":{"start":{"line":66,"column":2},"end":{"line":66,"column":null}},"38":{"start":{"line":69,"column":15},"end":{"line":69,"column":null}}},"fnMap":{"0":{"name":"(anonymous_8)","decl":{"start":{"line":1,"column":0},"end":{"line":1,"column":6}},"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":6}}},"1":{"name":"(anonymous_9)","decl":{"start":{"line":1,"column":23},"end":{"line":1,"column":24}},"loc":{"start":{"line":1,"column":39},"end":{"line":18,"column":null}}},"2":{"name":"(anonymous_10)","decl":{"start":{"line":29,"column":12},"end":{"line":29,"column":13}},"loc":{"start":{"line":29,"column":32},"end":{"line":47,"column":null}}},"3":{"name":"(anonymous_11)","decl":{"start":{"line":51,"column":24},"end":{"line":51,"column":25}},"loc":{"start":{"line":51,"column":41},"end":{"line":66,"column":null}}},"4":{"name":"(anonymous_12)","decl":{"start":{"line":58,"column":16},"end":{"line":58,"column":17}},"loc":{"start":{"line":58,"column":26},"end":{"line":58,"column":null}}},"5":{"name":"(anonymous_13)","decl":{"start":{"line":59,"column":22},"end":{"line":59,"column":30}},"loc":{"start":{"line":59,"column":30},"end":{"line":59,"column":null}}}},"branchMap":{"0":{"loc":{"start":{"line":2,"column":2},"end":{"line":3,"column":null}},"type":"if","locations":[{"start":{"line":2,"column":2},"end":{"line":3,"column":null}}]},"1":{"loc":{"start":{"line":5,"column":2},"end":{"line":6,"column":null}},"type":"if","locations":[{"start":{"line":5,"column":2},"end":{"line":6,"column":null}}]},"2":{"loc":{"start":{"line":8,"column":2},"end":{"line":9,"column":null}},"type":"if","locations":[{"start":{"line":8,"column":2},"end":{"line":9,"column":null}}]},"3":{"loc":{"start":{"line":11,"column":2},"end":{"line":12,"column":null}},"type":"if","locations":[{"start":{"line":11,"column":2},"end":{"line":12,"column":null}}]},"4":{"loc":{"start":{"line":14,"column":2},"end":{"line":15,"column":null}},"type":"if","locations":[{"start":{"line":14,"column":2},"end":{"line":15,"column":null}}]},"5":{"loc":{"start":{"line":17,"column":2},"end":{"line":18,"column":null}},"type":"if","locations":[{"start":{"line":17,"column":2},"end":{"line":18,"column":null}}]},"6":{"loc":{"start":{"line":33,"column":2},"end":{"line":34,"column":null}},"type":"if","locations":[{"start":{"line":33,"column":2},"end":{"line":34,"column":null}}]},"7":{"loc":{"start":{"line":37,"column":2},"end":{"line":38,"column":null}},"type":"if","locations":[{"start":{"line":37,"column":2},"end":{"line":38,"column":null}}]},"8":{"loc":{"start":{"line":37,"column":6},"end":{"line":37,"column":116}},"type":"binary-expr","locations":[{"start":{"line":37,"column":6},"end":{"line":37,"column":20}},{"start":{"line":37,"column":20},"end":{"line":37,"column":34}},{"start":{"line":37,"column":34},"end":{"line":37,"column":54}},{"start":{"line":37,"column":54},"end":{"line":37,"column":74}},{"start":{"line":37,"column":74},"end":{"line":37,"column":96}},{"start":{"line":37,"column":96},"end":{"line":37,"column":116}}]},"9":{"loc":{"start":{"line":41,"column":2},"end":{"line":47,"column":null}},"type":"switch","locations":[{"start":{"line":41,"column":17},"end":{"line":43,"column":null}},{"start":{"line":43,"column":17},"end":{"line":45,"column":null}},{"start":{"line":45,"column":29},"end":{"line":47,"column":null}}]},"10":{"loc":{"start":{"line":52,"column":2},"end":{"line":53,"column":null}},"type":"if","locations":[{"start":{"line":52,"column":2},"end":{"line":53,"column":null}}]},"11":{"loc":{"start":{"line":52,"column":6},"end":{"line":52,"column":45}},"type":"binary-expr","locations":[{"start":{"line":52,"column":6},"end":{"line":52,"column":17}},{"start":{"line":52,"column":17},"end":{"line":52,"column":45}}]},"12":{"loc":{"start":{"line":56,"column":2},"end":{"line":59,"column":null}},"type":"if","locations":[{"start":{"line":56,"column":2},"end":{"line":59,"column":null}}]}},"s":{"0":11,"1":1,"2":4384,"3":8,"4":4376,"5":3243,"6":1133,"7":1089,"8":44,"9":18,"10":26,"11":14,"12":12,"13":12,"14":1,"15":2192,"16":2192,"17":2192,"18":38,"19":2154,"20":4,"21":2150,"22":1613,"23":536,"24":1,"25":1,"26":436,"27":422,"28":14,"29":10,"30":10,"31":2192,"32":10,"33":424,"34":4,"35":4,"36":3,"37":4,"38":1},"f":{"0":9,"1":4384,"2":2192,"3":436,"4":2192,"5":424},"b":{"0":[8],"1":[3243],"2":[1089],"3":[18],"4":[14],"5":[12],"6":[38],"7":[4],"8":[2154,2,2152,1,2151,1],"9":[1613,536,1],"10":[422],"11":[436,431],"12":[10]}}
,"D:\\Workspace\\json-diff-kit\\src\\utils\\stringify.ts": {"path":"D:\\Workspace\\json-diff-kit\\src\\utils\\stringify.ts","statementMap":{"0":{"start":{"line":1,"column":0},"end":{"line":1,"column":null}},"1":{"start":{"line":2,"column":18},"end":{"line":18,"column":null}},"2":{"start":{"line":8,"column":2},"end":{"line":9,"column":null}},"3":{"start":{"line":9,"column":4},"end":{"line":9,"column":null}},"4":{"start":{"line":11,"column":12},"end":{"line":17,"column":null}},"5":{"start":{"line":14,"column":25},"end":{"line":14,"column":67}},"6":{"start":{"line":16,"column":18},"end":{"line":16,"column":null}},"7":{"start":{"line":18,"column":2},"end":{"line":18,"column":null}},"8":{"start":{"line":21,"column":15},"end":{"line":21,"column":null}}},"fnMap":{"0":{"name":"(anonymous_6)","decl":{"start":{"line":1,"column":0},"end":{"line":1,"column":null}},"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":null}}},"1":{"name":"(anonymous_7)","decl":{"start":{"line":2,"column":18},"end":{"line":2,"column":null}},"loc":{"start":{"line":7,"column":13},"end":{"line":18,"column":null}}},"2":{"name":"(anonymous_8)","decl":{"start":{"line":14,"column":20},"end":{"line":14,"column":25}},"loc":{"start":{"line":14,"column":25},"end":{"line":14,"column":67}}},"3":{"name":"(anonymous_9)","decl":{"start":{"line":16,"column":11},"end":{"line":16,"column":12}},"loc":{"start":{"line":16,"column":18},"end":{"line":16,"column":null}}}},"branchMap":{"0":{"loc":{"start":{"line":6,"column":2},"end":{"line":6,"column":null}},"type":"default-arg","locations":[{"start":{"line":6,"column":10},"end":{"line":6,"column":null}}]},"1":{"loc":{"start":{"line":8,"column":2},"end":{"line":9,"column":null}},"type":"if","locations":[{"start":{"line":8,"column":2},"end":{"line":9,"column":null}}]},"2":{"loc":{"start":{"line":8,"column":6},"end":{"line":8,"column":39}},"type":"binary-expr","locations":[{"start":{"line":8,"column":6},"end":{"line":8,"column":14}},{"start":{"line":8,"column":14},"end":{"line":8,"column":39}}]},"3":{"loc":{"start":{"line":11,"column":12},"end":{"line":17,"column":null}},"type":"cond-expr","locations":[{"start":{"line":12,"column":6},"end":{"line":12,"column":null}},{"start":{"line":13,"column":6},"end":{"line":17,"column":null}}]},"4":{"loc":{"start":{"line":13,"column":6},"end":{"line":17,"column":null}},"type":"cond-expr","locations":[{"start":{"line":14,"column":8},"end":{"line":14,"column":null}},{"start":{"line":15,"column":8},"end":{"line":17,"column":null}}]}},"s":{"0":24,"1":2,"2":53,"3":31,"4":22,"5":17,"6":16,"7":22,"8":2},"f":{"0":20,"1":53,"2":17,"3":16},"b":{"0":[8],"1":[31],"2":[53,52],"3":[5,17],"4":[8,9]}}
,"D:\\Workspace\\json-diff-kit\\src\\utils\\sort-inner-arrays.ts": {"path":"D:\\Workspace\\json-diff-kit\\src\\utils\\sort-inner-arrays.ts","statementMap":{"0":{"start":{"line":1,"column":0},"end":{"line":1,"column":null}},"1":{"start":{"line":9,"column":23},"end":{"line":26,"column":null}},"2":{"start":{"line":10,"column":2},"end":{"line":11,"column":null}},"3":{"start":{"line":11,"column":4},"end":{"line":11,"column":null}},"4":{"start":{"line":13,"column":2},"end":{"line":14,"column":null}},"5":{"start":{"line":14,"column":4},"end":{"line":14,"column":null}},"6":{"start":{"line":16,"column":2},"end":{"line":17,"column":null}},"7":{"start":{"line":17,"column":4},"end":{"line":17,"column":null}},"8":{"start":{"line":19,"column":2},"end":{"line":20,"column":null}},"9":{"start":{"line":20,"column":4},"end":{"line":20,"column":null}},"10":{"start":{"line":22,"column":2},"end":{"line":23,"column":null}},"11":{"start":{"line":23,"column":4},"end":{"line":23,"column":null}},"12":{"start":{"line":25,"column":2},"end":{"line":26,"column":null}},"13":{"start":{"line":26,"column":4},"end":{"line":26,"column":null}},"14":{"start":{"line":30,"column":12},"end":{"line":48,"column":null}},"15":{"start":{"line":31,"column":23},"end":{"line":31,"column":null}},"16":{"start":{"line":32,"column":23},"end":{"line":32,"column":null}},"17":{"start":{"line":34,"column":2},"end":{"line":35,"column":null}},"18":{"start":{"line":35,"column":4},"end":{"line":35,"column":null}},"19":{"start":{"line":38,"column":2},"end":{"line":39,"column":null}},"20":{"start":{"line":39,"column":4},"end":{"line":39,"column":null}},"21":{"start":{"line":42,"column":2},"end":{"line":48,"column":null}},"22":{"start":{"line":44,"column":6},"end":{"line":44,"column":null}},"23":{"start":{"line":46,"column":6},"end":{"line":46,"column":null}},"24":{"start":{"line":48,"column":6},"end":{"line":48,"column":null}},"25":{"start":{"line":52,"column":24},"end":{"line":67,"column":null}},"26":{"start":{"line":53,"column":2},"end":{"line":54,"column":null}},"27":{"start":{"line":54,"column":4},"end":{"line":54,"column":null}},"28":{"start":{"line":57,"column":2},"end":{"line":60,"column":null}},"29":{"start":{"line":58,"column":19},"end":{"line":58,"column":null}},"30":{"start":{"line":59,"column":4},"end":{"line":59,"column":null}},"31":{"start":{"line":59,"column":26},"end":{"line":59,"column":null}},"32":{"start":{"line":60,"column":4},"end":{"line":60,"column":null}},"33":{"start":{"line":60,"column":30},"end":{"line":60,"column":null}},"34":{"start":{"line":63,"column":17},"end":{"line":63,"column":null}},"35":{"start":{"line":64,"column":2},"end":{"line":65,"column":null}},"36":{"start":{"line":65,"column":4},"end":{"line":65,"column":null}},"37":{"start":{"line":67,"column":2},"end":{"line":67,"column":null}},"38":{"start":{"line":70,"column":15},"end":{"line":70,"column":null}}},"fnMap":{"0":{"name":"(anonymous_8)","decl":{"start":{"line":1,"column":0},"end":{"line":1,"column":null}},"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":null}}},"1":{"name":"(anonymous_9)","decl":{"start":{"line":9,"column":23},"end":{"line":9,"column":24}},"loc":{"start":{"line":9,"column":39},"end":{"line":26,"column":null}}},"2":{"name":"(anonymous_10)","decl":{"start":{"line":30,"column":12},"end":{"line":30,"column":13}},"loc":{"start":{"line":30,"column":32},"end":{"line":48,"column":null}}},"3":{"name":"(anonymous_11)","decl":{"start":{"line":52,"column":24},"end":{"line":52,"column":25}},"loc":{"start":{"line":52,"column":41},"end":{"line":67,"column":null}}},"4":{"name":"(anonymous_12)","decl":{"start":{"line":59,"column":16},"end":{"line":59,"column":17}},"loc":{"start":{"line":59,"column":26},"end":{"line":59,"column":null}}},"5":{"name":"(anonymous_13)","decl":{"start":{"line":60,"column":22},"end":{"line":60,"column":30}},"loc":{"start":{"line":60,"column":30},"end":{"line":60,"column":null}}}},"branchMap":{"0":{"loc":{"start":{"line":10,"column":2},"end":{"line":11,"column":null}},"type":"if","locations":[{"start":{"line":10,"column":2},"end":{"line":11,"column":null}}]},"1":{"loc":{"start":{"line":13,"column":2},"end":{"line":14,"column":null}},"type":"if","locations":[{"start":{"line":13,"column":2},"end":{"line":14,"column":null}}]},"2":{"loc":{"start":{"line":16,"column":2},"end":{"line":17,"column":null}},"type":"if","locations":[{"start":{"line":16,"column":2},"end":{"line":17,"column":null}}]},"3":{"loc":{"start":{"line":19,"column":2},"end":{"line":20,"column":null}},"type":"if","locations":[{"start":{"line":19,"column":2},"end":{"line":20,"column":null}}]},"4":{"loc":{"start":{"line":22,"column":2},"end":{"line":23,"column":null}},"type":"if","locations":[{"start":{"line":22,"column":2},"end":{"line":23,"column":null}}]},"5":{"loc":{"start":{"line":25,"column":2},"end":{"line":26,"column":null}},"type":"if","locations":[{"start":{"line":25,"column":2},"end":{"line":26,"column":null}}]},"6":{"loc":{"start":{"line":34,"column":2},"end":{"line":35,"column":null}},"type":"if","locations":[{"start":{"line":34,"column":2},"end":{"line":35,"column":null}}]},"7":{"loc":{"start":{"line":38,"column":2},"end":{"line":39,"column":null}},"type":"if","locations":[{"start":{"line":38,"column":2},"end":{"line":39,"column":null}}]},"8":{"loc":{"start":{"line":38,"column":6},"end":{"line":38,"column":116}},"type":"binary-expr","locations":[{"start":{"line":38,"column":6},"end":{"line":38,"column":20}},{"start":{"line":38,"column":20},"end":{"line":38,"column":34}},{"start":{"line":38,"column":34},"end":{"line":38,"column":54}},{"start":{"line":38,"column":54},"end":{"line":38,"column":74}},{"start":{"line":38,"column":74},"end":{"line":38,"column":96}},{"start":{"line":38,"column":96},"end":{"line":38,"column":116}}]},"9":{"loc":{"start":{"line":42,"column":2},"end":{"line":48,"column":null}},"type":"switch","locations":[{"start":{"line":42,"column":17},"end":{"line":44,"column":null}},{"start":{"line":44,"column":17},"end":{"line":46,"column":null}},{"start":{"line":46,"column":29},"end":{"line":48,"column":null}}]},"10":{"loc":{"start":{"line":53,"column":2},"end":{"line":54,"column":null}},"type":"if","locations":[{"start":{"line":53,"column":2},"end":{"line":54,"column":null}}]},"11":{"loc":{"start":{"line":53,"column":6},"end":{"line":53,"column":45}},"type":"binary-expr","locations":[{"start":{"line":53,"column":6},"end":{"line":53,"column":17}},{"start":{"line":53,"column":17},"end":{"line":53,"column":45}}]},"12":{"loc":{"start":{"line":57,"column":2},"end":{"line":60,"column":null}},"type":"if","locations":[{"start":{"line":57,"column":2},"end":{"line":60,"column":null}}]}},"s":{"0":11,"1":1,"2":4352,"3":8,"4":4344,"5":3213,"6":1131,"7":1087,"8":44,"9":18,"10":26,"11":14,"12":12,"13":12,"14":1,"15":2176,"16":2176,"17":2176,"18":38,"19":2138,"20":4,"21":2134,"22":1598,"23":535,"24":1,"25":1,"26":436,"27":422,"28":14,"29":10,"30":10,"31":2176,"32":10,"33":424,"34":4,"35":4,"36":3,"37":4,"38":1},"f":{"0":9,"1":4352,"2":2176,"3":436,"4":2176,"5":424},"b":{"0":[8],"1":[3213],"2":[1087],"3":[18],"4":[14],"5":[12],"6":[38],"7":[4],"8":[2138,2,2136,1,2135,1],"9":[1598,535,1],"10":[422],"11":[436,431],"12":[10]}}
,"D:\\Workspace\\json-diff-kit\\src\\utils\\stringify.ts": {"path":"D:\\Workspace\\json-diff-kit\\src\\utils\\stringify.ts","statementMap":{"0":{"start":{"line":1,"column":0},"end":{"line":1,"column":null}},"1":{"start":{"line":2,"column":18},"end":{"line":18,"column":null}},"2":{"start":{"line":8,"column":2},"end":{"line":9,"column":null}},"3":{"start":{"line":9,"column":4},"end":{"line":9,"column":null}},"4":{"start":{"line":11,"column":12},"end":{"line":17,"column":null}},"5":{"start":{"line":14,"column":25},"end":{"line":14,"column":67}},"6":{"start":{"line":16,"column":18},"end":{"line":16,"column":null}},"7":{"start":{"line":18,"column":2},"end":{"line":18,"column":null}},"8":{"start":{"line":21,"column":15},"end":{"line":21,"column":null}}},"fnMap":{"0":{"name":"(anonymous_6)","decl":{"start":{"line":1,"column":0},"end":{"line":1,"column":null}},"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":null}}},"1":{"name":"(anonymous_7)","decl":{"start":{"line":2,"column":18},"end":{"line":2,"column":null}},"loc":{"start":{"line":7,"column":13},"end":{"line":18,"column":null}}},"2":{"name":"(anonymous_8)","decl":{"start":{"line":14,"column":20},"end":{"line":14,"column":25}},"loc":{"start":{"line":14,"column":25},"end":{"line":14,"column":67}}},"3":{"name":"(anonymous_9)","decl":{"start":{"line":16,"column":11},"end":{"line":16,"column":12}},"loc":{"start":{"line":16,"column":18},"end":{"line":16,"column":null}}}},"branchMap":{"0":{"loc":{"start":{"line":6,"column":2},"end":{"line":6,"column":null}},"type":"default-arg","locations":[{"start":{"line":6,"column":10},"end":{"line":6,"column":null}}]},"1":{"loc":{"start":{"line":8,"column":2},"end":{"line":9,"column":null}},"type":"if","locations":[{"start":{"line":8,"column":2},"end":{"line":9,"column":null}}]},"2":{"loc":{"start":{"line":8,"column":6},"end":{"line":8,"column":39}},"type":"binary-expr","locations":[{"start":{"line":8,"column":6},"end":{"line":8,"column":14}},{"start":{"line":8,"column":14},"end":{"line":8,"column":39}}]},"3":{"loc":{"start":{"line":11,"column":12},"end":{"line":17,"column":null}},"type":"cond-expr","locations":[{"start":{"line":12,"column":6},"end":{"line":12,"column":null}},{"start":{"line":13,"column":6},"end":{"line":17,"column":null}}]},"4":{"loc":{"start":{"line":13,"column":6},"end":{"line":17,"column":null}},"type":"cond-expr","locations":[{"start":{"line":14,"column":8},"end":{"line":14,"column":null}},{"start":{"line":15,"column":8},"end":{"line":17,"column":null}}]}},"s":{"0":29,"1":2,"2":58,"3":36,"4":22,"5":17,"6":16,"7":22,"8":2},"f":{"0":25,"1":58,"2":17,"3":16},"b":{"0":[13],"1":[36],"2":[58,57],"3":[5,17],"4":[8,9]}}
}

@@ -371,4 +371,4 @@ var __create = Object.create;

while (keysLeft.length || keysRight.length) {
const keyLeft = keysLeft[0] ?? null;
const keyRight = keysRight[0] ?? null;
const keyLeft = keysLeft[0];
const keyRight = keysRight[0];
if (keyLeft === keyRight) {

@@ -415,3 +415,3 @@ if (get_type_default(lhs[keyLeft]) !== get_type_default(rhs[keyRight])) {

}
} else if (keyLeft && keyRight) {
} else if (keysLeft.length && keysRight.length) {
if (keyLeft < keyRight) {

@@ -440,3 +440,3 @@ const addedLines = stringify_default(lhs[keyLeft], null, 1).split("\n");

}
} else if (keyLeft) {
} else if (keysLeft.length) {
const addedLines = stringify_default(lhs[keyLeft], null, 1).split("\n");

@@ -452,3 +452,3 @@ for (let i = 0; i < addedLines.length; i++) {

}
} else if (keyRight) {
} else if (keysRight.length) {
const addedLines = stringify_default(rhs[keyRight], null, 1).split("\n");

@@ -610,5 +610,5 @@ for (let i = 0; i < addedLines.length; i++) {

while (arrLeft.length || arrRight.length) {
const itemLeft = arrLeft[0] ?? null;
const itemRight = arrRight[0] ?? null;
if (itemLeft && itemRight) {
const itemLeft = arrLeft[0];
const itemRight = arrRight[0];
if (arrLeft.length && arrRight.length) {
if (get_type_default(itemLeft) !== get_type_default(itemRight)) {

@@ -647,7 +647,7 @@ linesLeft.push({ level: level + 1, type: "remove", text: format_value_default(itemLeft) });

arrRight.shift();
} else if (itemLeft) {
} else if (arrLeft.length) {
linesLeft.push({ level: level + 1, type: "remove", text: format_value_default(itemLeft) });
linesRight.push({ level: level + 1, type: "equal", text: "" });
arrLeft.shift();
} else if (itemRight) {
} else if (arrRight.length) {
linesLeft.push({ level: level + 1, type: "equal", text: "" });

@@ -941,7 +941,62 @@ linesRight.push({ level: level + 1, type: "add", text: format_value_default(itemRight) });

// src/utils/get-segments.ts
var defaultOptions = {
threshold: 8,
margin: 3
};
var getSegments = (l, r, options) => {
if (!options) {
return [{ start: 0, end: l.length, isEqual: false }];
}
const segments = [];
for (let i = 0; i < l.length; i++) {
if (l[i].type === "equal" && r[i].type === "equal") {
if (segments.length && segments[segments.length - 1].isEqual) {
segments[segments.length - 1].end++;
} else {
segments.push({ start: i, end: i + 1, isEqual: true });
}
} else {
if (segments.length && !segments[segments.length - 1].isEqual) {
segments[segments.length - 1].end++;
} else {
segments.push({ start: i, end: i + 1, isEqual: false });
}
}
}
const _options = options === true ? defaultOptions : options;
const { threshold, margin } = _options;
if (threshold < margin * 2 + 1) {
console.warn(`Threshold (${threshold}) is no more than 2 margins + 1 "expand" line (${margin} * 2 + 1), it's not necessary to hide unchanged areas which have less than ${margin * 2 + 1} lines.`);
}
const result = [];
for (let i = 0; i < segments.length; i++) {
const segment = segments[i];
if (!segment.isEqual || segment.end - segment.start < threshold || segment.end - segment.start <= margin * 2 + 1) {
result.push(segment);
continue;
}
if (!i) {
result.push({ hasLinesBefore: true, hasLinesAfter: false, start: 0, end: segment.end - margin, isEqual: true });
result.push({ start: segment.end - margin, end: segment.end, isEqual: true });
} else if (i === segments.length - 1) {
result.push({ start: segment.start, end: segment.start + margin, isEqual: true });
result.push({ hasLinesBefore: false, hasLinesAfter: true, start: segment.start + margin, end: l.length, isEqual: true });
} else {
result.push({ start: segment.start, end: segment.start + margin, isEqual: true });
result.push({ hasLinesBefore: true, hasLinesAfter: true, start: segment.start + margin, end: segment.end - margin, isEqual: true });
result.push({ start: segment.end - margin, end: segment.end, isEqual: true });
}
}
return result;
};
var get_segments_default = getSegments;
// src/viewer.tsx
var DEFAULT_INDENT = 2;
var DEFAULT_EXPAND_MORE_LINES_LIMIT = 20;
var Viewer = (props) => {
const [linesLeft, linesRight] = props.diff;
const lineNumberWidth = props.lineNumbers ? `${String(linesLeft.length).length / 2}em` : 0;
const indent = props.indent ?? 2;
const indent = props.indent ?? DEFAULT_INDENT;
const indentChar = indent === "tab" ? " " : " ";

@@ -953,4 +1008,22 @@ const indentSize = indent === "tab" ? 1 : indent;

};
const hideUnchangedLines = props.hideUnchangedLines ?? false;
const linesLeftRef = React.useRef(linesLeft);
const linesRightRef = React.useRef(linesRight);
const segmentsRef = React.useRef(get_segments_default(linesLeft, linesRight, hideUnchangedLines));
const [, updateViewer] = React.useState({});
React.useEffect(() => {
linesLeftRef.current = linesLeft;
linesRightRef.current = linesRight;
segmentsRef.current = get_segments_default(linesLeft, linesRight, hideUnchangedLines);
updateViewer({});
}, [hideUnchangedLines, linesLeft, linesRight]);
const renderMeasureLine = () => /* @__PURE__ */ React.createElement("colgroup", {
className: "measure-line"
}, props.lineNumbers && /* @__PURE__ */ React.createElement("col", {
style: { width: `calc(${lineNumberWidth} + 16px)` }
}), /* @__PURE__ */ React.createElement("col", null), props.lineNumbers && /* @__PURE__ */ React.createElement("col", {
style: { width: `calc(${lineNumberWidth} + 16px)` }
}), /* @__PURE__ */ React.createElement("col", null));
const renderInlineDiffResult = (arr) => {
return arr.map((result) => /* @__PURE__ */ React.createElement(React.Fragment, null, result.map((item, index) => {
return arr.map((result) => result.map((item, index) => {
if (item.type === "equal") {

@@ -965,7 +1038,7 @@ return /* @__PURE__ */ React.createElement("span", {

}, item.text);
})));
}));
};
const renderLine = (index) => {
const l = linesLeft[index];
const r = linesRight[index];
const l = linesLeftRef.current[index];
const r = linesRightRef.current[index];
const [lText, rText] = props.highlightInlineDiff && l.type === "modify" && r.type === "modify" ? renderInlineDiffResult(get_inline_diff_default(l.text, r.text, inlineDiffOptions)) : [l.text, r.text];

@@ -990,6 +1063,93 @@ const bgColourL = l.type !== "equal" ? props.bgColour?.[l.type] ?? "" : "";

};
const onExpandBefore = (segmentIndex) => (lines) => {
const newSegments = [...segmentsRef.current];
const newSegment = newSegments[segmentIndex];
newSegments[segmentIndex] = {
...newSegment,
end: Math.max(newSegment.end - lines, newSegment.start)
};
if (segmentIndex + 1 < segmentsRef.current.length - 1) {
newSegments[segmentIndex + 1] = {
...newSegments[segmentIndex + 1],
start: Math.max(newSegment.end - lines, newSegment.start)
};
}
segmentsRef.current = newSegments;
updateViewer({});
};
const onExpandAfter = (segmentIndex) => (lines) => {
const newSegments = [...segmentsRef.current];
const newSegment = newSegments[segmentIndex];
newSegments[segmentIndex] = {
...newSegment,
start: Math.min(newSegment.start + lines, newSegment.end)
};
if (segmentIndex > 1) {
newSegments[segmentIndex - 1] = {
...newSegments[segmentIndex - 1],
end: Math.min(newSegment.start + lines, newSegment.end)
};
}
segmentsRef.current = newSegments;
updateViewer({});
};
const onExpandAll = (segmentIndex) => () => {
const newSegments = [...segmentsRef.current];
const newSegment = newSegments[segmentIndex];
newSegments[segmentIndex] = {
...newSegment,
start: newSegment.start,
end: newSegment.start
};
if (segmentIndex + 1 < segmentsRef.current.length - 1) {
newSegments[segmentIndex + 1] = {
...newSegments[segmentIndex + 1],
start: newSegment.start
};
} else {
newSegments[segmentIndex - 1] = {
...newSegments[segmentIndex - 1],
end: newSegment.end
};
}
segmentsRef.current = newSegments;
updateViewer({});
};
const renderExpandLine = (hasLinesBefore, hasLinesAfter, expandMoreLinesLimit, index) => {
return /* @__PURE__ */ React.createElement(React.Fragment, null, hasLinesBefore && /* @__PURE__ */ React.createElement("button", {
onClick: () => onExpandBefore(index)(expandMoreLinesLimit)
}, "\u2B06\uFE0F Show ", expandMoreLinesLimit, " lines before"), /* @__PURE__ */ React.createElement("button", {
onClick: () => onExpandAll(index)()
}, "\u2195\uFE0F Show all unchanged lines"), hasLinesAfter && /* @__PURE__ */ React.createElement("button", {
onClick: () => onExpandAfter(index)(expandMoreLinesLimit)
}, "\u2B07\uFE0F Show ", expandMoreLinesLimit, " lines after"));
};
const renderSegment = (segment, index) => {
const { start, end } = segment;
if (start === end) {
return null;
}
if (!("hasLinesBefore" in segment)) {
return Array(end - start).fill(0).map((_, index2) => renderLine(start + index2));
}
const { hasLinesBefore, hasLinesAfter } = segment;
const expandMoreLinesLimit = typeof hideUnchangedLines === "boolean" ? DEFAULT_EXPAND_MORE_LINES_LIMIT : hideUnchangedLines.expandMoreLinesLimit;
return /* @__PURE__ */ React.createElement("tr", {
key: `expand-line-${index}`,
className: "expand-line"
}, /* @__PURE__ */ React.createElement("td", {
colSpan: 4,
className: `${hasLinesBefore ? "has-lines-before" : ""} ${hasLinesAfter ? "has-lines-after" : ""}`
}, typeof hideUnchangedLines !== "boolean" && hideUnchangedLines.expandLineRenderer ? hideUnchangedLines.expandLineRenderer({
hasLinesBefore,
hasLinesAfter,
onExpandBefore: onExpandBefore(index),
onExpandAfter: onExpandAfter(index),
onExpandAll: onExpandAll(index)
}) : renderExpandLine(hasLinesBefore, hasLinesAfter, expandMoreLinesLimit, index)));
};
return /* @__PURE__ */ React.createElement("table", {
className: `json-diff-viewer ${props.className || ""}`,
style: props.style
}, /* @__PURE__ */ React.createElement("tbody", null, linesLeft.map((_, index) => renderLine(index))));
}, renderMeasureLine(), /* @__PURE__ */ React.createElement("tbody", null, segmentsRef.current.map(renderSegment)));
};

@@ -996,0 +1156,0 @@ Viewer.displayName = "Viewer";

{
"name": "json-diff-kit",
"version": "1.0.6",
"version": "1.0.7",
"description": "A better JSON differ & viewer.",

@@ -5,0 +5,0 @@ "module": "dist/index.js",

import * as React from 'react';
import type { DiffResult } from './differ';
import type { InlineDiffOptions } from './utils/get-inline-diff';
interface ExpandLineRendererOptions {
/**
* If this is `true`, you can show a "⬆️ Show xx lines" button
*/
hasLinesBefore: boolean;
/**
* If this is `true`, you can show a "⬇️ Show xx lines" button
*/
hasLinesAfter: boolean;
/**
* Call this function to expand `lines` lines before,
* if there are not enough lines before, it will expand all lines before.
*/
onExpandBefore: (lines: number) => void;
/**
* Call this function to expand `lines` lines after,
* if there are not enough lines after, it will expand all lines after.
*/
onExpandAfter: (lines: number) => void;
/**
* Call this function to expand all lines in this continuous part.
*/
onExpandAll: () => void;
}
export declare type HideUnchangedLinesOptions = boolean | {
/**
* If there are continuous unchanged lines exceeding the limit, they should be hidden,
* default is `8`.
*/
threshold?: number;
/**
* We can keep displaying some lines around the "expand" line for a better context,
* default is `3`.
*/
margin?: number;
/**
* Controls how many lines will be displayed when clicking the "Show xx lines before"
* or "Show xx lines after" button in the "expand" line, default is `20`.
*/
expandMoreLinesLimit?: number;
/**
* The custom renderer of the "expand" line,
* default renderer will produce the following buttons in this line:
*
* ```text
* [⬆️ Show 20 lines] [↕️ Show all unchanged lines] [⬇️ Show 20 lines]
* ```
*/
expandLineRenderer?: (options?: ExpandLineRendererOptions) => JSX.Element;
};
export interface ViewerProps {

@@ -21,2 +71,7 @@ /** The diff result `[before, after]`. */

inlineDiffOptions?: InlineDiffOptions;
/**
* Hide continuous unchanged lines and display an "expand" instead,
* default `false` means it won't hide unchanged lines.
*/
hideUnchangedLines?: HideUnchangedLinesOptions;
/** Extra class names */

@@ -23,0 +78,0 @@ className?: string;

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc