New Case Study:See how Anthropic automated 95% of dependency reviews with Socket.Learn More
Socket
Sign inDemoInstall
Socket

json-summary

Package Overview
Dependencies
Maintainers
1
Versions
15
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

json-summary - npm Package Compare versions

Comparing version

to
0.1.5

2

dist/json-summary.js

@@ -1,2 +0,2 @@

// https://github.com/AndrewTBurks/json-summary v0.1.4 Copyright 2019 Andrew Burks
// https://andrewtburks.dev/json-summary v0.1.5 Copyright 2019 Andrew Burks
(function (global, factory) {

@@ -3,0 +3,0 @@ typeof exports === 'object' && typeof module !== 'undefined' ? module.exports = factory() :

@@ -1,2 +0,2 @@

// https://github.com/AndrewTBurks/json-summary v0.1.4 Copyright 2019 Andrew Burks
// https://andrewtburks.dev/json-summary v0.1.5 Copyright 2019 Andrew Burks
!function(e,n){"object"==typeof exports&&"undefined"!=typeof module?module.exports=n():"function"==typeof define&&define.amd?define(n):(e=e||self).jsonSummary=n()}(this,function(){"use strict";return function({indentation:e=" ",indentCount:n=2,showExampleValue:t=!0,startExpanded:s=!1}={indentation:" ",indentCount:2,showExampleValue:!0,startExpanded:!1}){let a={indentation:e,indentCount:n,showExampleValue:t,startExpanded:s};function r(e,n,t){return{type:`<span class="json-summary json-summary-type json-summary-type-${e}">&lt;${e}&gt;</span>`,value:`<span class="json-summary json-summary-value json-summary-value-${t}">${e}</span>`,name:`<span class="json-summary json-summary-name">${e}</span>`,length:`<span class="json-summary json-summary-length">${e}</span>`,circular:`<span class="json-summary json-summary-circular">${e}</span>`,layer:`<span class="json-summary json-summary-checkbox ${a.startExpanded?"checked":""}">\n <input type="checkbox" ${a.startExpanded?"checked":""}>\n <span class="json-summary-checkboxmarker" onclick="(function(me){\n me.parentNode.classList.toggle('checked');\n })(this)"></span>\n </span><div class="json-summary json-summary-layer">${e}</div>`,child:`<div class="json-summary json-summary-child">${e}</div>`,keys:`<span class="json-summary json-summary-keys">${e}</span>`}[n]}return{summarize:function(e){let n=function e(n){let t={Array:n=>{let t={type:"Array"};return t.length=n.length,n.length&&(t.items={0:e(n[0])}),t},Object:n=>{let t={type:"Object"};t.keys=Object.keys(n),t.items={};for(let s of t.keys)t.items[s]=e(n[s]);return t},Other:e=>({type:typeof e,example:e})},s="Other";return n instanceof Array?s="Array":n instanceof Object&&(s="Object"),n&&n["*snippets_mark*"]?{type:s,circular:!0}:("Other"!==s&&(Object.defineProperty(n,"*snippets_mark*",{enumerable:!1,writable:!0,configurable:!0}),n["*snippets_mark*"]=!0),t[s](n))}(e);return function e(n){if(n&&n["*snippets_mark*"])if(delete n["*snippets_mark*"],n instanceof Array&&n.length)e(n[0]);else if(n instanceof Object)for(let t of Object.keys(n))e(n[t])}(e),n},printSummary:function(e){return function e(n,t){let s="";if(n.circular)s+=r("(circular reference)","circular");else if("Object"===n.type){s+="{";let i=n.keys.map(e=>`'${e}'`).join(", ");s+=r(i,"keys");let l=n.keys.map(s=>e(n.items[s],t+1));if(l.length){let e="\n";for(let s=0;s<n.keys.length;s++)e+=a.indentation.repeat((t+1)*a.indentCount),e+=r(n.keys[s],"name")+": ",e+=l[s],s<n.keys.length-1&&(e+=","),e+="\n";e+=a.indentation.repeat(t*a.indentCount),s+=r(e,"child")}s=r(s+="}","layer")}else if("Array"===n.type){if(s+=r(`(${n.length})`,"length")+" [",n.length){let r="Object"===n.items[0].type||"Array"===n.items[0].type;r&&(s+="\n"+a.indentation.repeat((t+1)*a.indentCount)),s+=e(n.items[0],t+1),r&&(s+="\n"+a.indentation.repeat(t*a.indentCount))}s+="]"}else null==n.example||null==n.example?s+=r("?","type"):s+=r(n.type,"type"),a.showExampleValue&&(s+=r(n.example,"value",n.type));return s}(e,0)}}}});

@@ -1,2 +0,2 @@

// https://github.com/AndrewTBurks/json-summary v0.1.4 Copyright 2019 Andrew Burks
// https://andrewtburks.dev/json-summary v0.1.5 Copyright 2019 Andrew Burks
!function(e,n){"object"==typeof exports&&"undefined"!=typeof module?module.exports=n():"function"==typeof define&&define.amd?define(n):(e=e||self).jsonSummary=n()}(this,function(){"use strict";return function({indentation:e=" ",indentCount:n=2,showExampleValue:t=!0,startExpanded:s=!1}={indentation:" ",indentCount:2,showExampleValue:!0,startExpanded:!1}){let a={indentation:e,indentCount:n,showExampleValue:t,startExpanded:s};function r(e,n,t){return{type:`<span class="json-summary json-summary-type json-summary-type-${e}">&lt;${e}&gt;</span>`,value:`<span class="json-summary json-summary-value json-summary-value-${t}">${e}</span>`,name:`<span class="json-summary json-summary-name">${e}</span>`,length:`<span class="json-summary json-summary-length">${e}</span>`,circular:`<span class="json-summary json-summary-circular">${e}</span>`,layer:`<span class="json-summary json-summary-checkbox ${a.startExpanded?"checked":""}">\n <input type="checkbox" ${a.startExpanded?"checked":""}>\n <span class="json-summary-checkboxmarker" onclick="(function(me){\n me.parentNode.classList.toggle('checked');\n })(this)"></span>\n </span><div class="json-summary json-summary-layer">${e}</div>`,child:`<div class="json-summary json-summary-child">${e}</div>`,keys:`<span class="json-summary json-summary-keys">${e}</span>`}[n]}return{summarize:function(e){let n=function e(n){let t={Array:n=>{let t={type:"Array"};return t.length=n.length,n.length&&(t.items={0:e(n[0])}),t},Object:n=>{let t={type:"Object"};t.keys=Object.keys(n),t.items={};for(let s of t.keys)t.items[s]=e(n[s]);return t},Other:e=>({type:typeof e,example:e})},s="Other";return n instanceof Array?s="Array":n instanceof Object&&(s="Object"),n&&n["*snippets_mark*"]?{type:s,circular:!0}:("Other"!==s&&(Object.defineProperty(n,"*snippets_mark*",{enumerable:!1,writable:!0,configurable:!0}),n["*snippets_mark*"]=!0),t[s](n))}(e);return function e(n){if(n&&n["*snippets_mark*"])if(delete n["*snippets_mark*"],n instanceof Array&&n.length)e(n[0]);else if(n instanceof Object)for(let t of Object.keys(n))e(n[t])}(e),n},printSummary:function(e){return function e(n,t){let s="";if(n.circular)s+=r("(circular reference)","circular");else if("Object"===n.type){s+="{";let i=n.keys.map(e=>`'${e}'`).join(", ");s+=r(i,"keys");let l=n.keys.map(s=>e(n.items[s],t+1));if(l.length){let e="\n";for(let s=0;s<n.keys.length;s++)e+=a.indentation.repeat((t+1)*a.indentCount),e+=r(n.keys[s],"name")+": ",e+=l[s],s<n.keys.length-1&&(e+=","),e+="\n";e+=a.indentation.repeat(t*a.indentCount),s+=r(e,"child")}s=r(s+="}","layer")}else if("Array"===n.type){if(s+=r(`(${n.length})`,"length")+" [",n.length){let r="Object"===n.items[0].type||"Array"===n.items[0].type;r&&(s+="\n"+a.indentation.repeat((t+1)*a.indentCount)),s+=e(n.items[0],t+1),r&&(s+="\n"+a.indentation.repeat(t*a.indentCount))}s+="]"}else null==n.example||null==n.example?s+=r("?","type"):s+=r(n.type,"type"),a.showExampleValue&&(s+=r(n.example,"value",n.type));return s}(e,0)}}}});
{
"name": "json-summary",
"version": "0.1.4",
"version": "0.1.5",
"description": "A simple JSON summarizer to extract the structure from a JSON object",
"keywords": [
"JSON",
"data",
"object",
"summary"
],
"main": "dist/json-summary-node.js",

@@ -10,3 +16,3 @@ "module": "index.js",

"scripts": {
"test": "jest",
"test": "jest && codecov",
"prepublish": "npm run build && npm test",

@@ -27,4 +33,5 @@ "build": "rollup -c && cp dist/json-summary.min.js docs/json-summary.min.js && cp summarizer.css docs/summarizer.css"

},
"homepage": "https://github.com/AndrewTBurks/json-summary",
"homepage": "https://andrewtburks.dev/json-summary",
"devDependencies": {
"codecov": "^3.3.0",
"jest": "^24.7.1",

@@ -36,3 +43,7 @@ "rollup": "^1.9.0",

"rollup-plugin-terser": "^4.0.4"
},
"jest": {
"coverageDirectory": "./coverage/",
"collectCoverage": true
}
}
# json-summary
[![npm version](https://img.shields.io/npm/v/json-summary.svg)](https://www.npmjs.com/package/json-summary)
[![npm downloads](https://img.shields.io/npm/dt/json-summary.svg)](https://www.npmjs.com/package/json-summary)
[![codecov](https://codecov.io/gh/AndrewTBurks/json-summary/branch/master/graph/badge.svg)](https://codecov.io/gh/AndrewTBurks/json-summary)
A simple JSON summarizer to extract the structure from a JSON object.
See usage and examples at: https://andrewtburks.dev/json-summary

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet