🚀 Big News: Socket Acquires Coana to Bring Reachability Analysis to Every Appsec Team.Learn more
Socket
Book a DemoInstallSign in
Socket

@jsonurl/jsonurl

Package Overview
Dependencies
Maintainers
1
Versions
12
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

@jsonurl/jsonurl - npm Package Compare versions

Comparing version

to
1.1.1

CHANGELOG.md

6

dist/jsonurl.min.js
/*!
* jsonurl.js v1.0.0-SNAPSHOT
* (c) 2020 David MacCormack
* jsonurl.js v1.1.1
* (c) 2021 David MacCormack
* Released under the MIT License.
*/
!function(e,r){"object"==typeof exports&&"undefined"!=typeof module?module.exports=r():"function"==typeof define&&define.amd?define(r):(e="undefined"!=typeof globalThis?globalThis:e||self).JsonURL=r()}(this,(function(){"use strict";function e(e,r){if(!(e instanceof r))throw new TypeError("Cannot call a class as a function")}function r(e,r){for(var t=0;t<r.length;t++){var n=r[t];n.enumerable=n.enumerable||!1,n.configurable=!0,"value"in n&&(n.writable=!0),Object.defineProperty(e,n.key,n)}}function t(e,t,n){return t&&r(e.prototype,t),n&&r(e,n),e}function n(e,r){if("function"!=typeof r&&null!==r)throw new TypeError("Super expression must either be null or a function");e.prototype=Object.create(r&&r.prototype,{constructor:{value:e,writable:!0,configurable:!0}}),r&&o(e,r)}function i(e){return(i=Object.setPrototypeOf?Object.getPrototypeOf:function(e){return e.__proto__||Object.getPrototypeOf(e)})(e)}function o(e,r){return(o=Object.setPrototypeOf||function(e,r){return e.__proto__=r,e})(e,r)}function a(){if("undefined"==typeof Reflect||!Reflect.construct)return!1;if(Reflect.construct.sham)return!1;if("function"==typeof Proxy)return!0;try{return Date.prototype.toString.call(Reflect.construct(Date,[],(function(){}))),!0}catch(e){return!1}}function u(e,r,t){return(u=a()?Reflect.construct:function(e,r,t){var n=[null];n.push.apply(n,r);var i=new(Function.bind.apply(e,n));return t&&o(i,t.prototype),i}).apply(null,arguments)}function c(e){var r="function"==typeof Map?new Map:void 0;return(c=function(e){if(null===e||(t=e,-1===Function.toString.call(t).indexOf("[native code]")))return e;var t;if("function"!=typeof e)throw new TypeError("Super expression must either be null or a function");if(void 0!==r){if(r.has(e))return r.get(e);r.set(e,n)}function n(){return u(e,arguments,i(this).constructor)}return n.prototype=Object.create(e.prototype,{constructor:{value:n,enumerable:!1,writable:!0,configurable:!0}}),o(n,e)})(e)}function s(e,r){return!r||"object"!=typeof r&&"function"!=typeof r?function(e){if(void 0===e)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return e}(e):r}function l(e){var r=a();return function(){var t,n=i(e);if(r){var o=i(this).constructor;t=Reflect.construct(n,arguments,o)}else t=n.apply(this,arguments);return s(this,t)}}var p=/\+/g,f=/%20/g,h=/ /g,d=/^[-A-Za-z0-9._~!$*;=@?/ ][-A-Za-z0-9._~!$*;=@?/' ]*$/,y=/^[-A-Za-z0-9._~!$*,;=@?/(),: ]+$/,w=/^(?:true|false|null|(?:[-]?[0-9]+(?:[.][0-9]+)?(?:[eE][-+]?[0-9]+)?))$/,v=40,m=41,x=44,b=58,A=38,S=101,O=108,g=117,E="JSON->URL: expected comma, open paren, or close paren",V="JSON->URL: expected comma or close paren",L="JSON->URL: expected value",j="JSON->URL: expected literal value",U="JSON->URL: unexpected character",C="JSON->URL: internal error",R="JSON->URL: unexpected end of text inside composite",P="JSON->URL: unexpected text after composite",J="JSON->URL: MaxParseChars exceeded",k="JSON->URL: MaxParseValues exceeded";function _(e,r,t){for(var n=0;r<t;r++)switch(e.charCodeAt(r)){case 48:case 49:case 50:case 51:case 52:case 53:case 54:case 55:case 56:case 57:n++;continue;default:return n}return n}function N(e,r,t){var n=0;switch(e.charCodeAt(r)){case 69:case S:r++,n++;break;default:return 0}switch(e.charCodeAt(r)){case 43:case 45:r++,n++}var i=_(e,r,t);return 0===i?0:n+i}function T(e,r,t){if(46!==e.charCodeAt(r))return 0;var n=_(e,r+1,t);return 0===n?0:1+n}function F(e,r,t){return 48===e.charCodeAt(r)?1:_(e,r,t)}function M(e){return"function"==typeof e.emptyValue?e.emptyValue():e.emptyValue}function I(e){return"function"==typeof e.nullValue?e.nullValue():e.nullValue}function D(e,r){return void 0===r?e:e+" at position "+r}function $(e,r,t,n){var i=!1,o=r;if(r===t)throw new SyntaxError(D(n,r));for(39===e.charCodeAt(r)&&(i=!0,r++);r<t;r++){var a=e.charCodeAt(r);if(!(a>=65&&a<=90)&&!(a>=97&&a<=122||a>=48&&a<=57))switch(a){case 39:if(i)return r+1;case 45:case 46:case 95:case 126:case 37:case 33:case 36:case 42:case 43:case 59:case 47:case 63:case 64:continue;case x:case b:case v:case m:if(!i){if(r===o)throw new SyntaxError(D(n,o));return r}continue;case A:case 61:if(r===o)throw new SyntaxError(D(n,o));return r;default:throw new SyntaxError(D(U,r))}}if(i)throw new SyntaxError(D("JSON->URL: quoted string still open",r));return t}function z(e,r,t,n){var i=n?e.substring(r+1,t-1):e.substring(r,t);return i=i.replace(p," "),i=decodeURIComponent(i)}function Z(e){var r=encodeURIComponent(e);return r=(r=(r=(r=(r=r.replace(f,"+")).replace(",","%x2C")).replace(":","%x3A")).replace("(","%x28")).replace(")","%x29")}Object.defineProperty(Array.prototype,"toJsonURLText",{value:function(){var e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{},r=arguments.length>1&&void 0!==arguments[1]?arguments[1]:0,t=void 0;return this.forEach((function(n){if("function"==typeof n){if(!e.callFunctions)return;for(;"function"==typeof n;)n=n()}if(void 0===n){if(e.ignoreUndefinedArrayMembers)return;n="null"}else if(null===n){if(e.ignoreNullArrayMembers)return;n="null"}else n=n.toJsonURLText(e,r+1);void 0===t?t=n:!e.wwwFormUrlEncoded||r>0?t+=","+n:t+="&"+n})),!e.isImplied||r>0?void 0===t?"()":"("+t+")":void 0===t?"":t}}),Object.defineProperty(Boolean.prototype,"toJsonURLText",{value:function(){return!0===this?"true":"false"}}),Object.defineProperty(Number.prototype,"toJsonURLText",{value:function(){return String(this)}}),Object.defineProperty(Object.prototype,"toJsonURLText",{value:function(){var e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{},r=arguments.length>1&&void 0!==arguments[1]?arguments[1]:0,t=void 0,n=Object.keys(this),i=this;return n.forEach((function(n){if(null!=n){var o=i[n];if("function"==typeof o){if(!e.callFunctions)return;for(;"function"==typeof o;)o=o()}if(void 0===o){if(e.ignoreUndefinedObjectMembers)return;o="null"}else if(null===o){if(e.ignoreNullObjectMembers)return;o="null"}else o=o.toJsonURLText(e,r+1);var a=n.toJsonURLText(e,r,!0);void 0===t?t=!e.wwwFormUrlEncoded||r>0?a+":"+o:a+"="+o:!e.wwwFormUrlEncoded||r>0?t+=","+a+":"+o:t+="&"+a+"="+o}})),!e.isImplied||r>0?void 0===t?"()":"("+t+")":void 0===t?"":t}}),Object.defineProperty(String.prototype,"toJsonURLText",{value:function(e,r,t){if(e.impliedStringLiterals)return Z(this);if(0===this.length)return"''";if(w.test(this))return!0===t?this:-1==this.indexOf("+")?"'"+this+"'":encodeURIComponent(this);if(d.test(this))return-1==this.indexOf(" ")?this:this.replace(h,"+");if(y.test(this))return-1==this.indexOf(" ")?"'"+this+"'":"'"+this.replace(h,"+")+"'";var n=Z(this);return 39==n.charCodeAt(0)?"%27"+n.substring(1):n}});var q=function(r){n(o,r);var i=l(o);function o(r){var t;return e(this,o),(t=i.call(this)).parser=r,t._depth=0,t}return t(o,[{key:"replaceAndPush",value:function(e,r,t){if(this[this._depth]=r,++this._depth>=this.parser.maxParseDepth)throw new Error(D("JSON->URL: MaxParseDepth exceeded",e));this.push(t)}},{key:"replace",value:function(e){this[this._depth]=e}},{key:"depth",value:function(){var e=arguments.length>0&&void 0!==arguments[0]&&arguments[0];return e&&(this._depth--,this.pop()),this._depth}}]),o}(c(Array)),B=function(r){n(o,r);var i=l(o);function o(r){var t;return e(this,o),(t=i.call(this)).parser=r,t.numValues=0,t}return t(o,[{key:"popObjectValue",value:function(e){e=e||this.pop();var r=this.pop(),t=this[this.length-1];return t[r]=e,t}},{key:"popArrayValue",value:function(e){e=e||this.pop();var r=this[this.length-1];return r.push(e),r}},{key:"checkValueLimit",value:function(e){var r=arguments.length>1&&void 0!==arguments[1]?arguments[1]:1;if(this.numValues+=r,this.numValues>this.parser.maxParseValues+1)throw new Error(D(k,e))}},{key:"appendArrayValue",value:function(e,r){var t=arguments.length>2&&void 0!==arguments[2]?arguments[2]:1;this.checkValueLimit(e,t),this.push(r)}}]),o}(c(Array));return function(){function r(t){for(e(this,r);"function"==typeof t;)t=t();void 0===t&&(t={}),this.maxParseDepth="number"==typeof t.maxParseDepth?parseInt(t.maxParseDepth):32,this.maxParseValues="number"==typeof t.maxParseValues?parseInt(t.maxParseValues):4096,this.maxParseChars="number"==typeof t.maxParseChars?parseInt(t.maxParseChars):32768,this.emptyValue=void 0===t.emptyValue?{}:t.emptyValue,this.nullValue=void 0===t.nullValue?null:t.nullValue}return t(r,[{key:"parseLiteral",value:function(e){var r,t,n,i,o,a=arguments.length>1&&void 0!==arguments[1]?arguments[1]:0,u=arguments.length>2&&void 0!==arguments[2]?arguments[2]:e.length,c=arguments.length>3&&void 0!==arguments[3]&&arguments[3],s=arguments.length>4&&void 0!==arguments[4]&&arguments[4];if(!0===s)return z(e,a,u,!1);switch(u-a){case 4:if(r=e.charCodeAt(a),t=e.charCodeAt(a+1),n=e.charCodeAt(a+2),i=e.charCodeAt(a+3),116===r&&114===t&&n===g&&i===S)return!c||"true";if(110===r&&t===g&&n===O&&i===O)return c?"null":I(this);break;case 5:if(r=e.charCodeAt(a),t=e.charCodeAt(a+1),n=e.charCodeAt(a+2),i=e.charCodeAt(a+3),o=e.charCodeAt(a+4),102===r&&97===t&&n===O&&115===i&&o===S)return!!c&&"false"}var l=!1,p=a,f=e.charCodeAt(a);switch(f){case 45:p++;break;case 39:l=!0}if(!l){var h=F(e,p,u);if(h>0&&(p+=h,p+=T(e,p,u),(p+=N(e,p,u))===u)){var d=e.substring(a,u);return c?d:Number(d)}}return z(e,a,u,l)}},{key:"parse",value:function(e){var r=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{};if(void 0!==e){var t=(e=String(e)).length;if(0===t){if(void 0!==r.impliedArray)return r.impliedArray;if(void 0!==r.impliedObject)return r.impliedObject;throw new SyntaxError(D(L,0))}if(t>this.maxParseChars)throw new Error(J);var n=new B(this),i=new q(this),o=0;if(void 0!==r.impliedObject)n.push(r.impliedObject),i.push(6);else if(void 0!==r.impliedArray)n.push(r.impliedArray),i.push(2);else{if(e.charCodeAt(0)!==v){var a=$(e,0,t,j);if(a!==t)throw new SyntaxError(D(j,0));return this.parseLiteral(e,0,t,!1,r.impliedStringLiterals)}i.push(1),o=1}for(;;){if(o===t)throw new SyntaxError(D(R,o));var u=e.charCodeAt(o),c=void 0,s=void 0;switch(i[i.depth()]){case 1:switch(u){case v:n.appendArrayValue(o,[]),i.replaceAndPush(o,3,1),o++;continue;case m:if(o++,-1===i.depth(!0)){if(o===t)return M(this);throw new SyntaxError(D(P,o))}if(n.appendArrayValue(o,M(this)),o===t&&0===i.depth()){if(r.impliedArray)return n.popArrayValue();if(r.impliedObject)return n.popObjectValue();throw new SyntaxError(D(R,o))}continue}if((s=$(e,o,t,L))===t)throw new SyntaxError(D(R,t));switch(n.checkValueLimit(o),u=e.charCodeAt(s),c=this.parseLiteral(e,o,s,u===b,r.impliedStringLiterals),o=s,u){case A:if(!r.wwwFormUrlEncoded||i.depth()>0)throw new SyntaxError(D(U,o));case x:i.replace(3),n.appendArrayValue(o,[]),n.push(c);continue;case m:switch(o++,n.appendArrayValue(o,[c]),i.depth(!0)){case-1:if(o===t)return n[0];throw new SyntaxError(D(P,o));case 0:if(o===t){if(r.impliedArray)return n.popArrayValue();if(r.impliedObject)return n.popObjectValue();throw new SyntaxError(D(R,o))}}continue;case 61:if(!r.wwwFormUrlEncoded||i.depth()>0)throw new SyntaxError(D(U,o));case b:i.replace(4),n.push({},c),o++;continue;default:throw new SyntaxError(D(j,o))}case 2:if(u===v){i.replaceAndPush(o,3,1),o++;continue}if(s=$(e,o,t,L),n.checkValueLimit(o),c=this.parseLiteral(e,o,s,!1,r.impliedStringLiterals),(o=s)===t){if(0===i.depth()&&r.impliedArray)return n.popArrayValue(c);throw new SyntaxError(D(R,t))}i.replace(3),n.push(c);continue;case 3:switch(n.popArrayValue(),u){case A:if(!r.wwwFormUrlEncoded||i.depth()>0)throw new SyntaxError(D(U,o));case x:i.replace(2),o++;continue;case m:switch(o++,i.depth(!0)){case-1:if(o===t&&!r.impliedArray)return n[0];throw new SyntaxError(D(P,o));case 0:if(o===t){if(r.impliedArray)return n.popArrayValue();if(r.impliedObject)return n.popObjectValue();throw new SyntaxError(D(R,o))}}continue}throw new SyntaxError(D(V,o));case 4:if(u===v){i.replaceAndPush(o,5,1),o++;continue}if(s=$(e,o,t,L),n.checkValueLimit(o),c=this.parseLiteral(e,o,s,!1,r.impliedStringLiterals),o=s,s===t){if(0===i.depth()&&r.impliedObject)return n.popObjectValue(c);throw new SyntaxError(D(R,t))}i.replace(5),n.push(c);continue;case 5:switch(n.popObjectValue(),u){case A:if(!r.wwwFormUrlEncoded||i.depth()>0)throw new SyntaxError(D(U,o));case x:i.replace(6),o++;continue;case m:switch(o++,i.depth(!0)){case-1:if(o===t&&!r.impliedObject)return n[0];throw new SyntaxError(D(P,o));case 0:if(o===t){if(r.impliedArray)return n.popArrayValue();if(r.impliedObject)return n.popObjectValue();throw new SyntaxError(D(P,o))}}continue}throw new SyntaxError(D(E,o));case 6:if((s=$(e,o,t,j))===t)throw new SyntaxError(D(R,t));switch(u=e.charCodeAt(s)){case 61:if(!r.wwwFormUrlEncoded||i.depth()>0)throw new SyntaxError(D(U,o));case b:break;default:throw new SyntaxError(s)}c=this.parseLiteral(e,o,s,!0,r.impliedStringLiterals),o=s+1,i.replace(4),n.push(c);continue;default:throw new SyntaxError(D(C,o))}}}}}],[{key:"stringify",value:function(e){var r=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{ignoreUndefinedObjectMembers:!0,impliedStringLiterals:!1};if(void 0!==e)return null===e?"null":e.toJsonURLText(r,0)}}]),r}()}));
!function(e,t){"object"==typeof exports&&"undefined"!=typeof module?module.exports=t():"function"==typeof define&&define.amd?define(t):(e="undefined"!=typeof globalThis?globalThis:e||self).JsonURL=t()}(this,(function(){"use strict";function e(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}function t(e,t){for(var r=0;r<t.length;r++){var n=t[r];n.enumerable=n.enumerable||!1,n.configurable=!0,"value"in n&&(n.writable=!0),Object.defineProperty(e,n.key,n)}}function r(e,r,n){return r&&t(e.prototype,r),n&&t(e,n),e}function n(e,t){if("function"!=typeof t&&null!==t)throw new TypeError("Super expression must either be null or a function");e.prototype=Object.create(t&&t.prototype,{constructor:{value:e,writable:!0,configurable:!0}}),t&&o(e,t)}function i(e){return(i=Object.setPrototypeOf?Object.getPrototypeOf:function(e){return e.__proto__||Object.getPrototypeOf(e)})(e)}function o(e,t){return(o=Object.setPrototypeOf||function(e,t){return e.__proto__=t,e})(e,t)}function s(){if("undefined"==typeof Reflect||!Reflect.construct)return!1;if(Reflect.construct.sham)return!1;if("function"==typeof Proxy)return!0;try{return Date.prototype.toString.call(Reflect.construct(Date,[],(function(){}))),!0}catch(e){return!1}}function a(e,t,r){return(a=s()?Reflect.construct:function(e,t,r){var n=[null];n.push.apply(n,t);var i=new(Function.bind.apply(e,n));return r&&o(i,r.prototype),i}).apply(null,arguments)}function u(e){var t="function"==typeof Map?new Map:void 0;return(u=function(e){if(null===e||(r=e,-1===Function.toString.call(r).indexOf("[native code]")))return e;var r;if("function"!=typeof e)throw new TypeError("Super expression must either be null or a function");if(void 0!==t){if(t.has(e))return t.get(e);t.set(e,n)}function n(){return a(e,arguments,i(this).constructor)}return n.prototype=Object.create(e.prototype,{constructor:{value:n,enumerable:!1,writable:!0,configurable:!0}}),o(n,e)})(e)}function c(e,t){return!t||"object"!=typeof t&&"function"!=typeof t?function(e){if(void 0===e)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return e}(e):t}function p(e){var t=s();return function(){var r,n=i(e);if(t){var o=i(this).constructor;r=Reflect.construct(n,arguments,o)}else r=n.apply(this,arguments);return c(this,r)}}var l="JSON->URL: expected literal value",h="JSON->URL: unexpected character",f="JSON->URL: unexpected end of text inside composite",d="JSON->URL: unexpected text after composite",y="JSON->URL: MaxParseValues exceeded",v="JSON->URL: the empty string is not allowed",w="JSON->URL: invalid escape sequence",m="JSON->URL: invalid percent-encoded sequence",x="JSON->URL: expected object value";function O(e,t){return void 0===t?e:e+" at position "+t}var b=16,E=[0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,6,0,0,6,6,48,10,20,20,6,6,20,6,6,6,6,6,6,6,6,6,6,6,6,6,20,6,0,48,0,6,6,6,6,6,6,6,6,6,6,6,6,6,6,6,6,6,6,6,6,6,6,6,6,6,6,6,6,0,0,0,0,6,0,6,6,6,6,6,6,6,6,6,6,6,6,6,6,6,6,6,6,6,6,6,6,6,6,6,6,0,0,0,6,0];function g(e){return e>127?0:E[e]}var A=function(){function t(r){e(this,t),this.setOrDefault(r,"allowEmptyUnquotedValues"),this.setOrDefault(r,"allowEmptyUnquotedKeys"),this.setOrDefault(r,"AQF"),this.setOrDefault(r,"coerceNullToEmptyString"),this.setOrDefault(r,"impliedArray"),this.setOrDefault(r,"impliedObject"),this.setOrDefault(r,"impliedStringLiterals"),this.setOrDefault(r,"noEmptyComposite"),this.setOrDefault(r,"wwwFormUrlEncoded")}return r(t,[{key:"setOrDefault",value:function(e,t,r){void 0!==e&&t in e?t in this||(this[t]=e[t]):void 0===r||t in this||(this[t]=r)}},{key:"setOverride",value:function(e,t){void 0!==e&&t in e&&(this[t]=e[t])}},{key:"setOrDefaultInt",value:function(e,t,r){this.setOrDefault(e,t,void 0===r?r:parseInt(r))}}]),t}(),S=function(t){n(o,t);var i=p(o);function o(t,r){var n;return e(this,o),(n=i.call(this,t)).setOrDefault(t,"emptyValue"),n.setOrDefault(r,"emptyValue",{}),n.setOverride(t,"getMissingValue"),n.setOrDefaultInt(t,"maxParseChars"),n.setOrDefaultInt(r,"maxParseChars",32768),n.setOrDefaultInt(t,"maxParseDepth"),n.setOrDefaultInt(r,"maxParseDepth",32),n.setOrDefaultInt(t,"maxParseValues"),n.setOrDefaultInt(r,"maxParseValues",4096),n.setOrDefault(t,"nullValue"),n.setOrDefault(r,"nullValue",null),n}return r(o,[{key:"getMissingValue",value:function(e,t){throw new SyntaxError(O(x,t))}}]),o}(A),V=function(t){n(i,t);var r=p(i);function i(t){var n;e(this,i),n=r.call(this,t);var o=!(void 0===t||!("impliedStringLiterals"in t)||!t.impliedStringLiterals)||void 0;return n.setOrDefault(t,"allowEmptyUnquotedValues",o),n.setOrDefault(t,"allowEmptyUnquotedKeys",o),n.setOrDefault(t,"callFunctions"),n.setOrDefault(t,"isImplied"),n.setOrDefault(t,"ignoreNullArrayMembers",o),n.setOrDefault(t,"ignoreNullObjectMembers",o),n.setOrDefault(t,"ignoreUndefinedArrayMembers",o),n.setOrDefault(t,"ignoreUndefinedObjectMembers",o),n.isImplied=n.isImplied||n.impliedArray||n.impliedObject,n}return i}(A),k=/\+/g,L=/ /g,U=/(![\s\S]?)/g,C=/^[-A-Za-z0-9._~!$*;=@?/ ][-A-Za-z0-9._~!$*;=@?/' ]*$/,D=/^[-A-Za-z0-9._~!$*,;=@?/(),: ]+$/,j=/^(?:true|false|null|(?:[-]?[0-9]+(?:[.][0-9]+)?(?:[eE][-+]?[0-9]+)?))$/,P=/[(),:]|%2[04]|%3B/gi,R={"%20":"+","%24":"$","(":"%28",")":"%29",",":"%2C",":":"%3A","%3B":";"},N=/[!(),:]|%2[01489C]|%3[AB]/gi,F={"%20":"+","%21":"!!","!":"!!","%24":"$","%28":"!(","(":"!(","%29":"!)",")":"!)","+":"!+","%2C":"!,",",":"!,","%3A":"!:",":":"!:","%3B":";"},J=40,I=41,T=44,M=58,q=38,_=48,$=65,Q=97,B=new Array(111);B[33]="!",B[40]="(",B[41]=")",B[43]="+",B[44]=",",B[45]=",",B[48]="0",B[49]="1",B[50]="2",B[51]="3",B[52]="4",B[53]="5",B[54]="6",B[55]="7",B[56]="8",B[57]="9",B[58]=":",B[116]="t",B[102]="f",B[110]="n";var K="",z=" ";function Z(e,t){var r=t?N:P,n=t?F:R;return encodeURIComponent(e).replace(r,(function(e){var t=n[e];return void 0===t?e:t}))}function G(e,t){switch(t){case _:return 0;case 49:return 1;case 50:return 2;case 51:return 3;case 52:return 4;case 53:return 5;case 54:return 6;case 55:return 7;case 56:return 8;case 57:return 9;case $:case Q:return 10;case 66:case 98:return 11;case 67:case 99:return 12;case 68:case 100:return 13;case 69:case 101:return 14;case 70:case 102:return 15;default:throw new SyntaxError(O(m,e))}}function H(e){if(e.coerceNullToEmptyString)return W(e,!1);if(e.impliedStringLiterals)throw new SyntaxError("JSON->URL: can not represent null with implied strings");return"null"}function W(e,t){if(t?e.allowEmptyUnquotedKeys:e.allowEmptyUnquotedValues)return K;if(e.AQF)return"!e";if(e.impliedStringLiterals)throw new SyntaxError(v);return"''"}Object.defineProperty(Array.prototype,"toJsonURLText",{value:function(){var e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{},t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:0,r=void 0;return this.forEach((function(n){if("function"==typeof n){if(!e.callFunctions)return;for(;"function"==typeof n;)n=n()}if(void 0===n){if(e.ignoreUndefinedArrayMembers)return;n=H(e)}else if(null===n){if(e.ignoreNullArrayMembers)return;n=H(e)}else n=n.toJsonURLText(e,t+1);void 0===r?r=n:!e.wwwFormUrlEncoded||t>0?r+=","+n:r+="&"+n})),!e.isImplied||t>0?void 0===r?"()":"("+r+")":void 0===r?K:r}}),Object.defineProperty(Boolean.prototype,"toJsonURLText",{value:function(){return!0===this?"true":"false"}}),Object.defineProperty(Number.prototype,"toJsonURLText",{value:function(e){var t=String(this);return e.impliedStringLiterals&&-1!==t.indexOf("+")?Z(t,e):t}}),Object.defineProperty(Object.prototype,"toJsonURLText",{value:function(){var e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{},t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:0,r=void 0,n=Object.keys(this),i=this;return n.forEach((function(n){if(null!=n){var o=i[n];if("function"==typeof o){if(!e.callFunctions)return;for(;"function"==typeof o;)o=o()}if(void 0===o){if(e.ignoreUndefinedObjectMembers)return;o=H(e)}else if(null===o){if(e.ignoreNullObjectMembers)return;o=H(e)}else o=o.toJsonURLText(e,t+1);var s=n.toJsonURLText(e,t,!0);void 0===r?r=!e.wwwFormUrlEncoded||t>0?s+":"+o:s+"="+o:!e.wwwFormUrlEncoded||t>0?r+=","+s+":"+o:r+="&"+s+"="+o}})),!e.isImplied||t>0?(e.noEmptyComposite&&void 0===r&&(r=":"),void 0===r?"()":"("+r+")"):void 0===r?K:r}}),Object.defineProperty(String.prototype,"toJsonURLText",{value:function(e,t,r){if(0===this.length)return W(e,r);if(e.impliedStringLiterals)return Z(this,e.AQF);if(j.test(this))return!0===r?this:e.AQF?"!"+this:-1==this.indexOf("+")?"'"+this+"'":encodeURIComponent(this);if(e.AQF)return Z(this,!0);if(C.test(this))return-1==this.indexOf(z)?this:this.replace(L,"+");if(D.test(this))return-1==this.indexOf(z)?"'"+this+"'":"'"+this.replace(L,"+")+"'";var n=Z(this);return 39==n.charCodeAt(0)?"%27"+n.substring(1):n}});var X=function(){function t(r,n,i,o){e(this,t),this.text=r,this.pos=this.markPos=n,this.end=i,this.options=o}return r(t,[{key:"skipAmps",value:function(){var e=arguments.length>0&&void 0!==arguments[0]&&arguments[0],t=this.text,r=this.end,n=this.pos;if(e)for(;n<r&&t.charCodeAt(n)===q;)n++;else if(n<r&&t.charCodeAt(n)===q){for(n++;n<r&&t.charCodeAt(n)===q;n++);n!==r&&n--}this.pos=n}},{key:"structChar",value:function(){var e=arguments.length>0&&void 0!==arguments[0]&&arguments[0];if(this.options.wwwFormUrlEncoded){var t=this.text.charCodeAt(this.pos);switch(t){case q:case 61:if(e)return;return this.pos++,t}}var r=this.pos,n=this.ordinal();switch(n){case T:case M:if(e)return void(this.pos=r);case J:case I:return n;default:return void(this.pos=r)}}},{key:"ordinal",value:function(e){return void 0!==e?this.text.charCodeAt(e):this.text.charCodeAt(this.pos++)}},{key:"accept",value:function(e){var t=this.pos;return this.ordinal()===e||(this.pos=t,!1)}},{key:"acceptPlus",value:function(){return 43==this.text.charCodeAt(this.pos)&&(this.pos++,!0)}},{key:"done",value:function(){return this.end<=this.pos}},{key:"validateLiteral",value:function(e,t){for(var r=this.text,n=this.end;e<n;e++){switch(g(r.charCodeAt(e))&t){case 0:throw new SyntaxError(O(h,e));case b:return e;case 8:return e+1;default:continue}}}},{key:"findLiteralEnd",value:function(){var e=this.text,t=this.end,r=this.pos,n=39===e.charCodeAt(r);n&&r++;var i=n?28:18;if(void 0!==(r=this.validateLiteral(r,i)))return r;if(n)throw new SyntaxError(O("JSON->URL: quoted string still open",r));return t}},{key:"isEmptyObject",value:function(){if(this.options.noEmptyComposite){var e=this.pos;if(!this.accept(M))return!1;var t=this.pos,r=this.accept(I);return this.pos=r?t:e,r}return!1}},{key:"parseLiteral",value:function(e){var t=this.pos,r=this.options,n=this.findLiteralEnd();if(void 0===e&&(e=this.ordinal(n)==M),n<=t)return function(e,t){if(t)return K;throw new SyntaxError(O(v,e))}(t,e?this.options.allowEmptyUnquotedKeys:this.options.allowEmptyUnquotedValues);if(!0===r.impliedStringLiterals)return this.parseStringLiteral(n,!0);var i=this.parseTrueFalseNull(n,e);if(void 0!==i)return i;var o=this.parseNumberLiteral(n,e);return void 0!==o?o:this.parseStringLiteral(n,!1)}},{key:"parseDigits",value:function(e){for(var t,r=!1;this.pos<e;)switch(this.ordinal()){case _:case 49:case 50:case 51:case 52:case 53:case 54:case 55:case 56:case 57:t=this.pos,r=!0;continue;default:return this.pos=t,r}return this.pos=t,r}},{key:"parseExponentValue",value:function(e){return!(e<=this.pos)&&(this.acceptPlus()||this.accept(45),this.parseDigits(e))}},{key:"parseExponent",value:function(e){var t=this.pos;switch(this.ordinal()){case 69:case 101:if(this.parseExponentValue(e))return!0}return this.pos=t,!1}},{key:"parseFraction",value:function(e){var t=this.pos;return!(e<=t)&&(!(!this.accept(46)||!this.parseDigits(e))||(this.pos=t,!1))}},{key:"parseInteger",value:function(e){return!(e<=this.pos)&&(!!this.accept(_)||this.parseDigits(e))}},{key:"parseNumberLiteral",value:function(e,t){var r=this.text,n=this.pos;if(this.accept(45),this.parseInteger(e)&&(this.parseFraction(e),this.parseExponent(e),this.pos===e)){var i=decodeURIComponent(r.substring(n,e));return t?i:Number(i)}this.pos=n}},{key:"parseStringLiteral",value:function(e,t){var r=this.text,n=this.pos,i=t||39!==r.charCodeAt(n)?r.substring(n,e):r.substring(n+1,e-1);return i=decodeURIComponent(i.replace(k,z)),this.pos=e,i}},{key:"parseTrueFalseNull",value:function(e,t){var r,n,i,o,s,a=this.text,u=this.pos;switch(e-u){case 4:if(r=a.charCodeAt(u),n=a.charCodeAt(u+1),i=a.charCodeAt(u+2),o=a.charCodeAt(u+3),116===r&&114===n&&117===i&&101===o)return this.pos=e,!t||"true";if(110===r&&117===n&&108===i&&108===o)return this.pos=e,t?"null":this.newNullValue();break;case 5:if(r=a.charCodeAt(u),n=a.charCodeAt(u+1),i=a.charCodeAt(u+2),o=a.charCodeAt(u+3),s=a.charCodeAt(u+4),102===r&&n===Q&&108===i&&115===o&&101===s)return this.pos=e,!!t&&"false"}}},{key:"newEmptyValue",value:function(){var e=this.options;if(e.noEmptyComposite)return[];var t=e.emptyValue;return"function"==typeof t?t():t}},{key:"newNullValue",value:function(){var e=this.options,t=e.nullValue;return"function"==typeof t&&(t=t()),null==t&&e.coerceNullToEmptyString&&(t=K),t}}]),t}(),Y=function(t){n(o,t);var i=p(o);function o(t,r,n,s){return e(this,o),i.call(this,t,r,n,s)}return r(o,[{key:"ordinal",value:function(e){var t,r,n=e||this.pos,i=this.text.charCodeAt(n);return 37===i?(t=function(e,t,r){if(r<=t+1)throw new SyntaxError(O(m,t));return G(t,e.charCodeAt(t))<<4|G(t,e.charCodeAt(t+1))}(this.text,n+1,this.end),r=3):(t=i,r=1),void 0===e&&(this.pos+=r),t}},{key:"acceptPlus",value:function(){return this.accept(43)}},{key:"findLiteralEnd",value:function(){for(var e=this.end,t=this.pos,r=this.text,n=t;;){if(e<=this.pos)return this.pos=t,e;switch(50&g(r.charCodeAt(this.pos))){case 48:if(this.options.wwwFormUrlEncoded)return n=this.pos,this.pos=t,n;case 0:throw new SyntaxError(O(h,n))}switch(this.ordinal()){case J:case I:case M:case T:return this.pos=t,n;case 33:if(this.pos===e)throw new SyntaxError(O(w,n));this.ordinal(),n=this.pos;break;default:n=this.pos}}}},{key:"parseStringLiteral",value:function(e){var t=this.text,r=this.pos,n=decodeURIComponent(t.substring(r,e).replace(k,z));return this.pos=e,"!e"===n?K:n.replace(U,(function(e,t,n){if(2===e.length){var i=e.charCodeAt(1),o=B[i];if(void 0!==o)return o}throw new SyntaxError(O(w,r+n))}))}}]),o}(X),ee=function(t){n(o,t);var i=p(o);function o(t){var r;return e(this,o),(r=i.call(this)).limits=t,r.parseDepth=0,r}return r(o,[{key:"replaceAndPush",value:function(e,t,r){if(this[this.parseDepth]=t,++this.parseDepth>=this.limits.maxParseDepth)throw new Error(O("JSON->URL: MaxParseDepth exceeded",e));this.push(r)}},{key:"replace",value:function(e){this[this.parseDepth]=e}},{key:"depth",value:function(){var e=arguments.length>0&&void 0!==arguments[0]&&arguments[0];return e&&(this.parseDepth--,this.pop()),this.parseDepth}}]),o}(u(Array)),te=function(t){n(o,t);var i=p(o);function o(t){var r;return e(this,o),(r=i.call(this)).limits=t,r.numValues=0,r}return r(o,[{key:"popObjectValue",value:function(e){e=e||this.pop();var t=this.pop(),r=this[this.length-1];return r[t]=e,r}},{key:"popArrayValue",value:function(e){e=e||this.pop();var t=this[this.length-1];return t.push(e),t}},{key:"checkValueLimit",value:function(e){var t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:1;if(this.numValues+=t,this.numValues>this.limits.maxParseValues+1)throw new Error(O(y,e))}},{key:"appendArrayValue",value:function(e,t){var r=arguments.length>2&&void 0!==arguments[2]?arguments[2]:1;this.checkValueLimit(e,r),this.push(t)}}]),o}(u(Array));function re(e){for(;"function"==typeof e;)e=e();return e}function ne(e,t,r,n){return"number"==typeof e?"number"!=typeof t&&(r=t):r=e,(r=re(r))instanceof S||(r=new S(r,n)),r}function ie(e,t,r,n){return n.AQF?new Y(e,t,r,n):new X(e,t,r,n)}function oe(e,t){return"number"==typeof e?e:t}function se(e,t,r,n,i){if(void 0!==e){n=ne(t,r,n,i),e=String(e);var o=oe(t,0),s=oe(r,e.length);if(s<=o){if(void 0!==n.impliedArray)return n.impliedArray;if(void 0!==n.impliedObject)return n.impliedObject;throw new SyntaxError(O("JSON->URL: expected value",0))}if(s>n.maxParseChars)throw new Error("JSON->URL: MaxParseChars exceeded");var a=n.wwwFormUrlEncoded&&(n.impliedObject||n.impliedArray),u=new te(n),c=new ee(n),p=ie(e,o,s,n);if(void 0!==n.impliedObject)u.push(n.impliedObject),c.push(6);else if(void 0!==n.impliedArray)u.push(n.impliedArray),c.push(2);else{if(p.structChar(!0)!==J){var y=p.parseLiteral(!1);if(p.done())return y;throw new SyntaxError(O(l,0))}c.push(1)}for(a&&p.skipAmps(!0);;){if(p.done())throw new SyntaxError(O(f,p.pos));var v=void 0,w=void 0,m=void 0;switch(c[c.depth()]){case 1:switch(p.structChar(!0)){case J:u.appendArrayValue(p.pos,[]),c.replaceAndPush(p.pos,3,1);continue;case I:if(-1===c.depth(!0)){if(p.done())return p.newEmptyValue();throw new SyntaxError(O(d,p.pos))}if(u.appendArrayValue(p.pos,p.newEmptyValue()),0===c.depth()&&(a&&p.skipAmps(),p.done())){if(n.impliedArray)return u.popArrayValue();if(n.impliedObject)return u.popObjectValue();throw new SyntaxError(O(f,p.pos))}continue}switch(u.checkValueLimit(p.pos),v=(w=p.isEmptyObject())?{}:p.parseLiteral(),m=p.pos,p.structChar()){case q:if(!n.wwwFormUrlEncoded||c.depth()>0)throw new SyntaxError(O(h,m));case T:c.replace(2),u.appendArrayValue(m,[]),u.push(v),u.popArrayValue();continue;case I:switch(w?u.push({}):u.appendArrayValue(m,[v]),c.depth(!0)){case-1:if(p.pos===s)return u[0];throw new SyntaxError(O(d,m));case 0:if(a&&p.skipAmps(),p.done()){if(n.impliedArray)return u.popArrayValue();if(n.impliedObject)return u.popObjectValue();throw new SyntaxError(O(f,m))}}continue;case 61:if(!n.wwwFormUrlEncoded||c.depth()>0)throw new SyntaxError(O(h,m));case M:c.replace(4),u.push({},v);continue;default:throw new SyntaxError(O(l,m))}case 2:if(p.accept(J)){c.replaceAndPush(p.pos,3,1);continue}if(u.checkValueLimit(p.pos),v=p.parseLiteral(!1),a&&p.skipAmps(),p.done()){if(0===c.depth()&&n.impliedArray)return u.popArrayValue(v);throw new SyntaxError(O(f,s))}c.replace(3),u.push(v);continue;case 3:switch(u.popArrayValue(),p.structChar()){case q:if(!n.wwwFormUrlEncoded||c.depth()>0)throw new SyntaxError(O(h,p.pos));case T:c.replace(2);continue;case I:switch(c.depth(!0)){case-1:if(p.done()&&!n.impliedArray)return u[0];throw new SyntaxError(O(d,p.pos));case 0:if(a&&p.skipAmps(),p.done()){if(n.impliedArray)return u.popArrayValue();if(n.impliedObject)return u.popObjectValue();throw new SyntaxError(O(f,p.pos))}}continue}throw new SyntaxError(O("JSON->URL: expected comma or close paren",p.pos));case 4:if(p.accept(J)){c.replaceAndPush(p.pos,5,1);continue}if(u.checkValueLimit(p.pos),v=p.parseLiteral(!1),a&&p.skipAmps(),p.done()){if(0===c.depth()&&n.impliedObject)return u.popObjectValue(v);throw new SyntaxError(O(f,s))}c.replace(5),u.push(v);continue;case 5:switch(u.popObjectValue(),m=p.pos,p.structChar()){case q:if(!n.wwwFormUrlEncoded||c.depth()>0)throw new SyntaxError(O(h,m));case T:c.replace(6);continue;case I:switch(c.depth(!0)){case-1:if(p.done()&&!n.impliedObject)return u[0];throw new SyntaxError(O(d,p.pos));case 0:if(a&&p.skipAmps(),p.done()){if(n.impliedArray)return u.popArrayValue();if(n.impliedObject)return u.popObjectValue();throw new SyntaxError(O(d,p.pos))}}continue}throw new SyntaxError(O("JSON->URL: expected comma, open paren, or close paren",p.pos));case 6:if(v=p.parseLiteral(!0),a&&p.skipAmps(),p.done()){if(n.impliedObject&&0==c.depth())return u.push(v,n.getMissingValue(v)),u.popObjectValue();throw new SyntaxError(O(f,s))}switch(p.structChar()){case 61:if(!n.wwwFormUrlEncoded||c.depth()>0)throw new SyntaxError(O(h,p.pos));case M:break;case q:if(!n.wwwFormUrlEncoded||c.depth()>0)throw new SyntaxError(O(h,p.pos));case T:if(n.impliedObject&&0==c.depth()){u.push(v,n.getMissingValue(v)),u.popObjectValue();continue}default:throw new SyntaxError(O(x,p.pos))}c.replace(4),u.push(v);continue;default:throw new SyntaxError(O("JSON->URL: internal error",p.pos))}}}}return function(){function t(r){for(e(this,t);"function"==typeof r;)r=r();void 0===r&&(r={}),this.maxParseDepth="number"==typeof r.maxParseDepth?parseInt(r.maxParseDepth):32,this.maxParseValues="number"==typeof r.maxParseValues?parseInt(r.maxParseValues):4096,this.maxParseChars="number"==typeof r.maxParseChars?parseInt(r.maxParseChars):32768,this.emptyValue=void 0===r.emptyValue?{}:r.emptyValue,this.nullValue=void 0===r.nullValue?null:r.nullValue}return r(t,[{key:"parseLiteral",value:function(e){var t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:0,r=arguments.length>2&&void 0!==arguments[2]?arguments[2]:void 0,n=arguments.length>3&&void 0!==arguments[3]&&arguments[3],i=arguments.length>4?arguments[4]:void 0;void 0!==e&&(e=String(e)),void 0===r&&(r=e.length);var o=ie(e,t,r,ne(i));return o.parseLiteral(n)}},{key:"parse",value:function(e,t,r,n){return se(e,t,r,n,this)}}],[{key:"parse",value:function(e,t,r,n){return se(e,t,r,n,void 0)}},{key:"stringify",value:function(e,t){if(void 0!==e)return t=new V(re(t)),null===e?H(t):e.toJsonURLText(t,0)}}]),t}()}));
{
"name": "@jsonurl/jsonurl",
"version": "1.0.3",
"version": "1.1.1",
"publishConfig": {

@@ -16,3 +16,3 @@ "access": "public"

"lint": "env DEBUG=eslint:cli-engine eslint .",
"jsdoc": "jsdoc -c jsdoc.config.js"
"jsdoc": "jsdoc -c jsdoc.config.js -a public"
},

@@ -35,22 +35,24 @@ "repository": {

"homepage": "https://www.jsonurl.org/",
"dependencies": {
"@babel/runtime": "^7.11.2"
"peerDependencies": {
"@babel/core": "^7.13.10",
"@babel/runtime": "^7.13.10",
"typescript": "^4.2.3"
},
"devDependencies": {
"@babel/cli": "^7.11.6",
"@babel/plugin-transform-runtime": "^7.11.5",
"@babel/preset-env": "^7.11.5",
"@rollup/plugin-babel": "^5.2.1",
"@babel/cli": "^7.13.10",
"@babel/plugin-transform-runtime": "^7.13.10",
"@babel/preset-env": "^7.13.12",
"@rollup/plugin-babel": "^5.3.0",
"@rollup/plugin-commonjs": "^15.1.0",
"@rollup/plugin-node-resolve": "^9.0.0",
"babel-jest": "^26.5.2",
"babel-jest": "^26.6.3",
"editorconfig": "^0.15.3",
"eslint": "^7.9.0",
"eslint-config-prettier": "^6.12.0",
"eslint": "^7.22.0",
"eslint-config-prettier": "^6.15.0",
"eslint-plugin-jest": "^23.20.0",
"eslint-plugin-prettier": "^3.1.4",
"jest": "^26.4.2",
"eslint-plugin-prettier": "^3.3.1",
"jest": "^26.6.3",
"jsdoc": "^3.6.6",
"prettier": "^2.1.2",
"rollup": "^2.28.1",
"prettier": "^2.2.1",
"rollup": "^2.42.4",
"rollup-plugin-eslint": "^7.0.0",

@@ -57,0 +59,0 @@ "rollup-plugin-terser": "^7.0.2"

@@ -44,4 +44,4 @@ # JSON&#x2192;URL

<script
src="https://cdn.jsdelivr.net/npm/@jsonurl/jsonurl@1.0.1"
integrity="sha384-X9eggnze0lccwuooEyVZu+LN9+HDcchxa9L9K1NObZelfMNcGSzT822Ikr2eZ3WD"
src="https://cdn.jsdelivr.net/npm/@jsonurl/jsonurl@1.1.0"
integrity="sha384-JCtJokkM2P1NvInO8p82t17dv0kqMRWhrgLU+H8KIHlev5bM9hot93290mWx50u9"
crossorigin="anonymous"></script>

@@ -53,4 +53,4 @@ ```

```js
let p = new JsonURL();
let value = p.parse( "(Hello:World!)" );
let value = JsonURL.parse( "(Hello:World!)" );
let string = JsonURL.stringify( value );
```

@@ -57,0 +57,0 @@ There are options available, but that's all you need to get started.

Sorry, the diff of this file is too big to display

Sorry, the diff of this file is too big to display

Sorry, the diff of this file is too big to display