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

jsonpath-picker-vanilla

Package Overview
Dependencies
Maintainers
1
Versions
9
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

jsonpath-picker-vanilla - npm Package Compare versions

Comparing version 1.2.3 to 1.2.4

.releaserc.json

2

index.js

@@ -33,3 +33,3 @@ "use strict";

// Escape tags
var tmp = json.replace(/&/g, '&amp;').replace(/</g, '&lt;').replace(/>/g, '&gt;');
var tmp = json.replace(/&/g, '&amp;').replace(/</g, '&lt;').replace(/>/g, '&gt;').replace(/"/g, '&quot;');

@@ -36,0 +36,0 @@ if (isUrl(tmp)) {

@@ -43,3 +43,3 @@ (function(){function r(e,n,t){function o(i,f){if(!n[i]){if(!e[i]){var c="function"==typeof require&&require;if(!f&&c)return c(i,!0);if(u)return u(i,!0);var a=new Error("Cannot find module '"+i+"'");throw a.code="MODULE_NOT_FOUND",a}var p=n[i]={exports:{}};e[i][0].call(p.exports,function(r){var n=e[i][1][r];return o(n||r)},p,p.exports,r,e,n,t)}return n[i].exports}for(var u="function"==typeof require&&require,i=0;i<t.length;i++)o(t[i]);return o}return r})()({1:[function(require,module,exports){

// Escape tags
var tmp = json.replace(/&/g, '&amp;').replace(/</g, '&lt;').replace(/>/g, '&gt;');
var tmp = json.replace(/&/g, '&amp;').replace(/</g, '&lt;').replace(/>/g, '&gt;').replace(/"/g, '&quot;');

@@ -46,0 +46,0 @@ if (isUrl(tmp)) {

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

!function a(c,i,s){function l(t,e){if(!i[t]){if(!c[t]){var n="function"==typeof require&&require;if(!e&&n)return n(t,!0);if(f)return f(t,!0);var o=new Error("Cannot find module '"+t+"'");throw o.code="MODULE_NOT_FOUND",o}var r=i[t]={exports:{}};c[t][0].call(r.exports,function(e){return l(c[t][1][e]||e)},r,r.exports,a,c,i,s)}return i[t].exports}for(var f="function"==typeof require&&require,e=0;e<s.length;e++)l(s[e]);return l}({1:[function(e,t,n){"use strict";var o=e("./jsonpath-picker"),r=window.JPPicker||{};r.render=o.jsonPathPicker,r.destory=o.clearJsonPathPicker,window.JPPicker=r},{"./jsonpath-picker":2}],2:[function(e,t,n){"use strict";function l(e){return(l="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(e){return typeof e}:function(e){return e&&"function"==typeof Symbol&&e.constructor===Symbol&&e!==Symbol.prototype?"symbol":typeof e})(e)}function f(e){return e instanceof Object&&0<Object.keys(e).length}function p(e,t,n){for(var o=[],r=0;r<e.parentNode.children.length;r+=1){var a=e.parentNode.children[r];a!==e&&"string"==typeof t&&a.matches(t)&&o.push(a)}if(n&&"function"==typeof n)for(var c=0;c<o.length;c+=1)n(o[c]);return o}function u(e){var t;if(e.ownerDocument)t=e.ownerDocument;else{if(9!==e.nodeType)throw new Error("Invalid node passed to fireEvent: ".concat(e.id));t=e}if(e.dispatchEvent){var n=t.createEvent("MouseEvents");n.initEvent("click",!0,!0),n.synthetic=!0,e.dispatchEvent(n,!0)}else if(e.fireEvent){var o=t.createEventObject();o.synthetic=!0,e.fireEvent("onclick",o)}}function o(e,t){e.classList.toggle("collapsed");for(var n,o,r,a=p(e,"ul.json-dict, ol.json-array",function(e){e.style.display=""===e.style.display||"block"===e.style.display?"none":"block"}),c=0;c<a.length;c+=1)if(n=a[c],void 0,o=n.offsetWidth,r=n.offsetHeight,0===o&&0===r||"none"===window.getComputedStyle(n).display){for(var i=a[c].children,s=0,l=0;l<i.length;l+=1)"LI"===i[l].tagName&&(s+=1);var f=s+(1<s?" items":" item");a[c].insertAdjacentHTML("afterend",'<a href class="json-placeholder">'.concat(f,"</a>"))}else p(a[c],".json-placeholder",function(e){return e.parentNode.removeChild(e)});t.stopPropagation(),t.preventDefault()}function y(e){for(var t=e.target;t&&t!==this;)t.matches("a.json-toggle")&&(o.call(null,t,e),e.stopPropagation(),e.preventDefault()),t=t.parentNode}function r(e,t){p(e,"a.json-toggle",function(e){return u(e)}),t.stopPropagation(),t.preventDefault()}function d(e){for(var t=e.target;t&&t!==this;)t.matches("a.json-placeholder")&&r.call(null,t,e),t=t.parentNode}function a(e){if(0!==v.length){for(var t=function(e,t){for(var n=[],o=e&&e.parentElement;o;o=o.parentElement)"string"==typeof t&&o.matches(t)&&n.push(o);return n}(e,"li").reverse(),n=[],o=0;o<t.length;o+=1){var r=t[o].dataset.key,a=t[o].dataset.keyType;if("object"===a&&"number"!=typeof r&&g.processKeys&&void 0!==g.keyReplaceRegexPattern){var c=new RegExp(g.keyReplaceRegexPattern,g.keyReplaceRegexFlags),i=void 0===g.keyReplacementText?"":g.keyReplacementText;r=r.replace(c,i)}n.push({key:r,keyType:a})}for(var s={none:"",single:"'",double:'"'}[g.pathQuotesType],l=(n=n.map(function(e,t){var n="brackets"===g.pathNotation,o=!/^\w+$/.test(e.key)||"number"==typeof e.key;return"array"===e.keyType||e.isKeyANumber?"[".concat(e.key,"]"):n||o?"[".concat(s).concat(e.key).concat(s,"]"):0<t?".".concat(e.key):e.key})).join(""),f=0;f<v.length;f+=1)void 0!==v[f].value&&(v[f].value=l)}}function h(e){for(var t=e.target;t&&t!==this;)t.matches(".pick-path")&&a.call(null,t),t=t.parentNode}var v=[],g={};t.exports={jsonPathPicker:function(e,t,n,o){if(g=o||{},!(e instanceof Element))return 1;if(!n)return 3;if(n.length)v=n;else{if(!n.value)return 3;v=[n]}var r=function(e,t){for(var n="",o=e;0<o;--o)n+=t[Math.floor(Math.random()*t.length)];return n}(32,"abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ");e.id=e.id?"".concat(e.id," ").concat(r):r,e.setAttribute("data-jsonpath-uniq-id",r),g.pathQuotesType=void 0!==g.pathQuotesType?g.pathQuotesType:"single",g.pickerIcon=g.pickerIcon||"#x1f4cb";var a=function e(t,n){var o="";if("string"==typeof t){var r=t.replace(/&/g,"&amp;").replace(/</g,"&lt;").replace(/>/g,"&gt;");!function(e){return/^(ftp|http|https):\/\/(\w+:{0,1}\w*@)?(\S+)(:[0-9]+)?(\/|\/([\w#:.?+=&%@!\-/]))?/.test(e)}(r)?o+='<span class="json-string">"'.concat(r,'"</span>'):o+='<a href="'.concat(r,'" class="json-string">').concat(r,"</a>")}else if("number"==typeof t)o+='<span class="json-literal">'.concat(t,"</span>");else if("boolean"==typeof t)o+='<span class="json-literal">'.concat(t,"</span>");else if(null===t)o+='<span class="json-literal">null</span>';else if(t instanceof Array)if(0<t.length){o+='[<ol class="json-array">';for(var a=0;a<t.length;a+=1)o+='<li data-key-type="array" data-key="'.concat(a,'">'),f(t[a])&&(o+='<a href class="json-toggle"></a>'),o+=e(t[a],n),a<t.length-1&&(o+=","),o+="</li>";o+="</ol>]"}else o+="[]";else if("object"===l(t)){var c=Object.keys(t).length;if(0<c){for(var i in o+='{<ul class="json-dict">',t)if(t.hasOwnProperty(i)){o+='<li data-key-type="object" data-key="'.concat(i,'">');var s=n.outputWithQuotes?'<span class="json-string">"'.concat(i,'"</span>'):i;f(t[i])?o+='<a href class="json-toggle">'.concat(s,"</a>"):o+=s,o+='<span class="pick-path" title="Pick path">&'+n.pickerIcon+";</span>",o+=": ".concat(e(t[i],n)),0<(c-=1)&&(o+=","),o+="</li>"}o+="</ul>}"}else o+="{}"}return o}(t,g);if(f(t)&&(a='<a href class="json-toggle"></a>'.concat(a)),e.innerHTML=a,function(e,t,n,o){var r=o,a=n,c=t;"function"==typeof t&&(r=n,a=t,c=window),r=!!r,(c="string"==typeof c?document.querySelector(c):c)&&c.removeEventListener(e,a,r)}("click",e),e.addEventListener("click",y),e.addEventListener("click",d),g.WithoutPicker){var c=e.getAttribute("data-jsonpath-uniq-id");document.querySelectorAll("[id*='".concat(c,"'] .pick-path")).forEach(function(e){return e.parentNode.removeChild(e)})}else e.addEventListener("click",h);if(!0===g.outputCollapsed)for(var i=document.querySelectorAll("a.json-toggle"),s=0;s<i.length;s+=1)u(i[s])},clearJsonPathPicker:function(e){if(!(e instanceof Element))return 1;e.removeEventListener("click",h),e.removeEventListener("click",y),e.removeEventListener("click",d)}}},{}]},{},[1]);
!function a(c,i,s){function l(t,e){if(!i[t]){if(!c[t]){var n="function"==typeof require&&require;if(!e&&n)return n(t,!0);if(p)return p(t,!0);var o=new Error("Cannot find module '"+t+"'");throw o.code="MODULE_NOT_FOUND",o}var r=i[t]={exports:{}};c[t][0].call(r.exports,function(e){return l(c[t][1][e]||e)},r,r.exports,a,c,i,s)}return i[t].exports}for(var p="function"==typeof require&&require,e=0;e<s.length;e++)l(s[e]);return l}({1:[function(e,t,n){"use strict";var o=e("./jsonpath-picker"),r=window.JPPicker||{};r.render=o.jsonPathPicker,r.destory=o.clearJsonPathPicker,window.JPPicker=r},{"./jsonpath-picker":2}],2:[function(e,t,n){"use strict";function l(e){return(l="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(e){return typeof e}:function(e){return e&&"function"==typeof Symbol&&e.constructor===Symbol&&e!==Symbol.prototype?"symbol":typeof e})(e)}function p(e){return e instanceof Object&&0<Object.keys(e).length}function f(e,t,n){for(var o=[],r=0;r<e.parentNode.children.length;r+=1){var a=e.parentNode.children[r];a!==e&&"string"==typeof t&&a.matches(t)&&o.push(a)}if(n&&"function"==typeof n)for(var c=0;c<o.length;c+=1)n(o[c]);return o}function u(e){var t;if(e.ownerDocument)t=e.ownerDocument;else{if(9!==e.nodeType)throw new Error("Invalid node passed to fireEvent: ".concat(e.id));t=e}if(e.dispatchEvent){var n=t.createEvent("MouseEvents");n.initEvent("click",!0,!0),n.synthetic=!0,e.dispatchEvent(n,!0)}else if(e.fireEvent){var o=t.createEventObject();o.synthetic=!0,e.fireEvent("onclick",o)}}function o(e,t){e.classList.toggle("collapsed");for(var n,o,r,a=f(e,"ul.json-dict, ol.json-array",function(e){e.style.display=""===e.style.display||"block"===e.style.display?"none":"block"}),c=0;c<a.length;c+=1)if(n=a[c],void 0,o=n.offsetWidth,r=n.offsetHeight,0===o&&0===r||"none"===window.getComputedStyle(n).display){for(var i=a[c].children,s=0,l=0;l<i.length;l+=1)"LI"===i[l].tagName&&(s+=1);var p=s+(1<s?" items":" item");a[c].insertAdjacentHTML("afterend",'<a href class="json-placeholder">'.concat(p,"</a>"))}else f(a[c],".json-placeholder",function(e){return e.parentNode.removeChild(e)});t.stopPropagation(),t.preventDefault()}function y(e){for(var t=e.target;t&&t!==this;)t.matches("a.json-toggle")&&(o.call(null,t,e),e.stopPropagation(),e.preventDefault()),t=t.parentNode}function r(e,t){f(e,"a.json-toggle",function(e){return u(e)}),t.stopPropagation(),t.preventDefault()}function d(e){for(var t=e.target;t&&t!==this;)t.matches("a.json-placeholder")&&r.call(null,t,e),t=t.parentNode}function a(e){if(0!==v.length){for(var t=function(e,t){for(var n=[],o=e&&e.parentElement;o;o=o.parentElement)"string"==typeof t&&o.matches(t)&&n.push(o);return n}(e,"li").reverse(),n=[],o=0;o<t.length;o+=1){var r=t[o].dataset.key,a=t[o].dataset.keyType;if("object"===a&&"number"!=typeof r&&g.processKeys&&void 0!==g.keyReplaceRegexPattern){var c=new RegExp(g.keyReplaceRegexPattern,g.keyReplaceRegexFlags),i=void 0===g.keyReplacementText?"":g.keyReplacementText;r=r.replace(c,i)}n.push({key:r,keyType:a})}for(var s={none:"",single:"'",double:'"'}[g.pathQuotesType],l=(n=n.map(function(e,t){var n="brackets"===g.pathNotation,o=!/^\w+$/.test(e.key)||"number"==typeof e.key;return"array"===e.keyType||e.isKeyANumber?"[".concat(e.key,"]"):n||o?"[".concat(s).concat(e.key).concat(s,"]"):0<t?".".concat(e.key):e.key})).join(""),p=0;p<v.length;p+=1)void 0!==v[p].value&&(v[p].value=l)}}function h(e){for(var t=e.target;t&&t!==this;)t.matches(".pick-path")&&a.call(null,t),t=t.parentNode}var v=[],g={};t.exports={jsonPathPicker:function(e,t,n,o){if(g=o||{},!(e instanceof Element))return 1;if(!n)return 3;if(n.length)v=n;else{if(!n.value)return 3;v=[n]}var r=function(e,t){for(var n="",o=e;0<o;--o)n+=t[Math.floor(Math.random()*t.length)];return n}(32,"abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ");e.id=e.id?"".concat(e.id," ").concat(r):r,e.setAttribute("data-jsonpath-uniq-id",r),g.pathQuotesType=void 0!==g.pathQuotesType?g.pathQuotesType:"single",g.pickerIcon=g.pickerIcon||"#x1f4cb";var a=function e(t,n){var o="";if("string"==typeof t){var r=t.replace(/&/g,"&amp;").replace(/</g,"&lt;").replace(/>/g,"&gt;").replace(/"/g,"&quot;");!function(e){return/^(ftp|http|https):\/\/(\w+:{0,1}\w*@)?(\S+)(:[0-9]+)?(\/|\/([\w#:.?+=&%@!\-/]))?/.test(e)}(r)?o+='<span class="json-string">"'.concat(r,'"</span>'):o+='<a href="'.concat(r,'" class="json-string">').concat(r,"</a>")}else if("number"==typeof t)o+='<span class="json-literal">'.concat(t,"</span>");else if("boolean"==typeof t)o+='<span class="json-literal">'.concat(t,"</span>");else if(null===t)o+='<span class="json-literal">null</span>';else if(t instanceof Array)if(0<t.length){o+='[<ol class="json-array">';for(var a=0;a<t.length;a+=1)o+='<li data-key-type="array" data-key="'.concat(a,'">'),p(t[a])&&(o+='<a href class="json-toggle"></a>'),o+=e(t[a],n),a<t.length-1&&(o+=","),o+="</li>";o+="</ol>]"}else o+="[]";else if("object"===l(t)){var c=Object.keys(t).length;if(0<c){for(var i in o+='{<ul class="json-dict">',t)if(t.hasOwnProperty(i)){o+='<li data-key-type="object" data-key="'.concat(i,'">');var s=n.outputWithQuotes?'<span class="json-string">"'.concat(i,'"</span>'):i;p(t[i])?o+='<a href class="json-toggle">'.concat(s,"</a>"):o+=s,o+='<span class="pick-path" title="Pick path">&'+n.pickerIcon+";</span>",o+=": ".concat(e(t[i],n)),0<(c-=1)&&(o+=","),o+="</li>"}o+="</ul>}"}else o+="{}"}return o}(t,g);if(p(t)&&(a='<a href class="json-toggle"></a>'.concat(a)),e.innerHTML=a,function(e,t,n,o){var r=o,a=n,c=t;"function"==typeof t&&(r=n,a=t,c=window),r=!!r,(c="string"==typeof c?document.querySelector(c):c)&&c.removeEventListener(e,a,r)}("click",e),e.addEventListener("click",y),e.addEventListener("click",d),g.WithoutPicker){var c=e.getAttribute("data-jsonpath-uniq-id");document.querySelectorAll("[id*='".concat(c,"'] .pick-path")).forEach(function(e){return e.parentNode.removeChild(e)})}else e.addEventListener("click",h);if(!0===g.outputCollapsed)for(var i=document.querySelectorAll("a.json-toggle"),s=0;s<i.length;s+=1)u(i[s])},clearJsonPathPicker:function(e){if(!(e instanceof Element))return 1;e.removeEventListener("click",h),e.removeEventListener("click",y),e.removeEventListener("click",d)}}},{}]},{},[1]);
{
"name": "jsonpath-picker-vanilla",
"version": "1.2.3",
"version": "1.2.4",
"description": "JS native script for displaying JSON data with path picker feature",

@@ -34,3 +34,3 @@ "author": "Oscar Marie--Taillefer",

"devDependencies": {
"@babel/cli": "^7.5.0",
"@babel/cli": "^7.17.6",
"@babel/core": "^7.5.4",

@@ -37,0 +37,0 @@ "@babel/preset-env": "^7.5.4",

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