Socket
Socket
Sign inDemoInstall

json-ptr

Package Overview
Dependencies
Maintainers
1
Versions
91
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

json-ptr - npm Package Compare versions

Comparing version 2.1.1-master.6efd1ec to 2.1.1-master.98922c7

2

dist.browser/json-ptr.js
/*! For license information please see json-ptr.js.LICENSE.txt */
(()=>{"use strict";var e={607:(e,t,r)=>{Object.defineProperty(t,"__esModule",{value:!0});const n=r(655);n.__exportStar(r(699),t),n.__exportStar(r(882),t),n.__exportStar(r(762),t)},762:(e,t,r)=>{Object.defineProperty(t,"__esModule",{value:!0}),t.JsonReference=t.JsonPointer=void 0;const n=r(882);function o(e){return"object"==typeof e&&null!==e}function i(e){return o(e)&&!d.isReference(e)}function a(e,t,r){const a=new Map,c=[{obj:e,path:[]}];for(;c.length;){const{obj:e,path:u}=c.shift();if(t(r(u),e),i(e))if(a.set(e,new f(n.encodeUriFragmentIdentifier(u))),Array.isArray(e)){let t=-1;const r=e.length;for(;++t<r;){const r=e[t];o(r)&&a.has(r)?c.push({obj:new d(a.get(r)),path:u.concat([t+""])}):c.push({obj:r,path:u.concat([t+""])})}}else{const t=Object.keys(e),r=t.length;let n=-1;for(;++n<r;){const r=e[t[n]];o(r)&&a.has(r)?c.push({obj:new d(a.get(r)),path:u.concat(t[n])}):c.push({obj:r,path:u.concat(t[n])})}}}}const c=Symbol("pointer"),u=Symbol("fragmentId"),s=Symbol("getter");class f{constructor(e){this.path=n.decodePtrInit(e)}static create(e){return new f(e)}static has(e,t){return("string"==typeof t||Array.isArray(t))&&(t=new f(t)),t.has(e)}static get(e,t){return("string"==typeof t||Array.isArray(t))&&(t=new f(t)),t.get(e)}static set(e,t,r,n=!1){return("string"==typeof t||Array.isArray(t))&&(t=new f(t)),t.set(e,r,n)}static unset(e,t){return("string"==typeof t||Array.isArray(t))&&(t=new f(t)),t.unset(e)}static decode(e){return n.pickDecoder(e)(e)}static visit(e,t,r=!1){a(e,t,r?n.encodeUriFragmentIdentifier:n.encodePointer)}static listPointers(e){const t=[];return a(e,((e,r)=>{t.push({pointer:e,value:r})}),n.encodePointer),t}static listFragmentIds(e){const t=[];return a(e,((e,r)=>{t.push({fragmentId:e,value:r})}),n.encodeUriFragmentIdentifier),t}static flatten(e,t=!1){const r={};return a(e,((e,t)=>{r[e]=t}),t?n.encodeUriFragmentIdentifier:n.encodePointer),r}static map(e,t=!1){const r=new Map;return a(e,r.set.bind(r),t?n.encodeUriFragmentIdentifier:n.encodePointer),r}get(e){return this[s]||(this[s]=n.compilePointerDereference(this.path)),this[s](e)}set(e,t,r=!1){return n.setValueAtPath(e,t,this.path,r)}unset(e){return n.unsetValueAtPath(e,this.path)}has(e){return void 0!==this.get(e)}concat(e){return new f(this.path.concat(e instanceof f?e.path:n.decodePtrInit(e)))}get pointer(){return void 0===this[c]&&(this[c]=n.encodePointer(this.path)),this[c]}get uriFragmentIdentifier(){return this[u]||(this[u]=n.encodeUriFragmentIdentifier(this.path)),this[u]}toString(){return this.pointer}}t.JsonPointer=f;const l=Symbol("pointer");class d{constructor(e){this[l]=e instanceof f?e:new f(e),this.$ref=this[l].uriFragmentIdentifier}static isReference(e){if(!e)return!1;const t=e;return"string"==typeof t.$ref&&"function"==typeof t.resolve}resolve(e){return this[l].get(e)}pointer(){return this[l]}toString(){return this.$ref}}t.JsonReference=d},699:(e,t)=>{Object.defineProperty(t,"__esModule",{value:!0})},882:(e,t)=>{function r(e,t,r){let n="",o=e,i=0,a=-1;for(;(a=o.indexOf(t))>-1;)n+=e.substring(i,i+a)+r,o=o.substring(a+t.length,o.length),i+=a+t.length;return o.length>0&&(n+=e.substring(e.length-o.length,e.length)),n}function n(e){let t=-1;const n=e.length,o=new Array(n);for(;++t<n;)"string"==typeof e[t]?o[t]=r(r(decodeURIComponent(e[t]),"~1","/"),"~0","~"):o[t]=e[t];return o}function o(e){let t=-1;const n=e.length,o=new Array(n);for(;++t<n;)"string"==typeof e[t]?o[t]=encodeURIComponent(r(r(e[t],"~","~0"),"/","~1")):o[t]=e[t];return o}function i(e){let t=-1;const n=e.length,o=new Array(n);for(;++t<n;)"string"==typeof e[t]?o[t]=r(r(e[t],"~1","/"),"~0","~"):o[t]=e[t];return o}function a(e){let t=-1;const n=e.length,o=new Array(n);for(;++t<n;)"string"==typeof e[t]?o[t]=r(r(e[t],"~","~0"),"/","~1"):o[t]=e[t];return o}function c(e){if("string"!=typeof e)throw new TypeError("Invalid type: JSON Pointers are represented as strings.");if(0===e.length)return[];if("/"!==e[0])throw new ReferenceError("Invalid JSON Pointer syntax. Non-empty pointer must begin with a solidus `/`.");return i(e.substring(1).split("/"))}function u(e){if("string"!=typeof e)throw new TypeError("Invalid type: JSON Pointers are represented as strings.");if(0===e.length||"#"!==e[0])throw new ReferenceError("Invalid JSON Pointer syntax; URI fragment identifiers must begin with a hash.");if(1===e.length)return[];if("/"!==e[1])throw new ReferenceError("Invalid JSON Pointer syntax.");return n(e.substring(2).split("/"))}function s(e,t){if("number"==typeof t)return t;const r=t.length;if(!r)return-1;let n=0;if(1===r&&"-"===t[0])return Array.isArray(e)?e.length:0;for(;++n<r;)if(t[n]<"0"||t[n]>"9")return-1;return parseInt(t,10)}function f(e){return(null==e?void 0:e.length)>0&&"#"===e[0]}function l(e){return f(e)?u:c}Object.defineProperty(t,"__esModule",{value:!0}),t.decodePtrInit=t.pickDecoder=t.looksLikeFragment=t.unsetValueAtPath=t.setValueAtPath=t.compilePointerDereference=t.toArrayIndexReference=t.encodeUriFragmentIdentifier=t.decodeUriFragmentIdentifier=t.encodePointer=t.decodePointer=t.encodePointerSegments=t.decodePointerSegments=t.encodeFragmentSegments=t.decodeFragmentSegments=t.replace=void 0,t.replace=r,t.decodeFragmentSegments=n,t.encodeFragmentSegments=o,t.decodePointerSegments=i,t.encodePointerSegments=a,t.decodePointer=c,t.encodePointer=function(e){if(!e||e&&!Array.isArray(e))throw new TypeError("Invalid type: path must be an array of segments.");return 0===e.length?"":"/".concat(a(e).join("/"))},t.decodeUriFragmentIdentifier=u,t.encodeUriFragmentIdentifier=function(e){if(!e||e&&!Array.isArray(e))throw new TypeError("Invalid type: path must be an array of segments.");return 0===e.length?"#":"#/".concat(o(e).join("/"))},t.toArrayIndexReference=s,t.compilePointerDereference=function(e){let t="if (typeof(it) !== 'undefined'";return 0===e.length?e=>e:(t=e.reduce(((t,n,o)=>t+" && \n\ttypeof((it = it['"+r(r(e[o]+"","\\","\\\\"),"'","\\'")+"'])) !== 'undefined'"),"if (typeof(it) !== 'undefined'"),t+=") {\n\treturn it;\n }",new Function("it",t))},t.setValueAtPath=function(e,t,r,n=!1){if(0===r.length)throw new Error("Cannot set the root object; assign it directly.");if(void 0===e)throw new TypeError("Cannot set values on undefined");let o=e;const i=r.length,a=r.length-1;let c,u,f,l=-1;for(;++l<i;){if(c=r[l],"__proto__"===c||"constructor"===c||"prototype"===c)throw new Error("Attempted prototype pollution disallowed.");if(Array.isArray(o)){if("-"===c&&l===a)return void o.push(t);if(f=s(o,c),o.length>f){if(l===a){u=o[f],o[f]=t;break}o=o[f]}else if(l===a&&f===o.length){if(n)return void o.push(t)}else n&&(o=o[f]=l===a?t:{})}else{if(void 0===o[c]){if(n){if(l===a)return void(o[c]=t);if(-1!==s(o[c],r[l+1])){o=o[c]=[];continue}o=o[c]={};continue}return}if(l===a){u=o[c],o[c]=t;break}o=o[c]}}return u},t.unsetValueAtPath=function(e,t){if(0===t.length)throw new Error("Cannot unset the root object; assign it directly.");if(void 0===e)throw new TypeError("Cannot unset values on undefined");let r=e;const n=t.length,o=t.length-1;let i,a,c,u=-1;for(;++u<n;)if(i=t[u],Array.isArray(r)){if(c=s(r,i),c>=r.length)return;if(u===o){a=r[c],delete r[c];break}r=r[c]}else{if(void 0===r[i])return;if(u===o){a=r[i],delete r[i];break}r=r[i]}return a},t.looksLikeFragment=f,t.pickDecoder=l,t.decodePtrInit=function(e){return Array.isArray(e)?e.slice(0):l(e)(e)}},655:(e,t,r)=>{r.r(t),r.d(t,{__extends:()=>o,__assign:()=>i,__rest:()=>a,__decorate:()=>c,__param:()=>u,__metadata:()=>s,__awaiter:()=>f,__generator:()=>l,__createBinding:()=>d,__exportStar:()=>p,__values:()=>h,__read:()=>y,__spread:()=>g,__spreadArrays:()=>b,__spreadArray:()=>w,__await:()=>v,__asyncGenerator:()=>m,__asyncDelegator:()=>_,__asyncValues:()=>P,__makeTemplateObject:()=>O,__importStar:()=>j,__importDefault:()=>I,__classPrivateFieldGet:()=>A,__classPrivateFieldSet:()=>x});var n=function(e,t){return(n=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(e,t){e.__proto__=t}||function(e,t){for(var r in t)Object.prototype.hasOwnProperty.call(t,r)&&(e[r]=t[r])})(e,t)};function o(e,t){if("function"!=typeof t&&null!==t)throw new TypeError("Class extends value "+String(t)+" is not a constructor or null");function r(){this.constructor=e}n(e,t),e.prototype=null===t?Object.create(t):(r.prototype=t.prototype,new r)}var i=function(){return(i=Object.assign||function(e){for(var t,r=1,n=arguments.length;r<n;r++)for(var o in t=arguments[r])Object.prototype.hasOwnProperty.call(t,o)&&(e[o]=t[o]);return e}).apply(this,arguments)};function a(e,t){var r={};for(var n in e)Object.prototype.hasOwnProperty.call(e,n)&&t.indexOf(n)<0&&(r[n]=e[n]);if(null!=e&&"function"==typeof Object.getOwnPropertySymbols){var o=0;for(n=Object.getOwnPropertySymbols(e);o<n.length;o++)t.indexOf(n[o])<0&&Object.prototype.propertyIsEnumerable.call(e,n[o])&&(r[n[o]]=e[n[o]])}return r}function c(e,t,r,n){var o,i=arguments.length,a=i<3?t:null===n?n=Object.getOwnPropertyDescriptor(t,r):n;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)a=Reflect.decorate(e,t,r,n);else for(var c=e.length-1;c>=0;c--)(o=e[c])&&(a=(i<3?o(a):i>3?o(t,r,a):o(t,r))||a);return i>3&&a&&Object.defineProperty(t,r,a),a}function u(e,t){return function(r,n){t(r,n,e)}}function s(e,t){if("object"==typeof Reflect&&"function"==typeof Reflect.metadata)return Reflect.metadata(e,t)}function f(e,t,r,n){return new(r||(r=Promise))((function(o,i){function a(e){try{u(n.next(e))}catch(e){i(e)}}function c(e){try{u(n.throw(e))}catch(e){i(e)}}function u(e){var t;e.done?o(e.value):(t=e.value,t instanceof r?t:new r((function(e){e(t)}))).then(a,c)}u((n=n.apply(e,t||[])).next())}))}function l(e,t){var r,n,o,i,a={label:0,sent:function(){if(1&o[0])throw o[1];return o[1]},trys:[],ops:[]};return i={next:c(0),throw:c(1),return:c(2)},"function"==typeof Symbol&&(i[Symbol.iterator]=function(){return this}),i;function c(i){return function(c){return function(i){if(r)throw new TypeError("Generator is already executing.");for(;a;)try{if(r=1,n&&(o=2&i[0]?n.return:i[0]?n.throw||((o=n.return)&&o.call(n),0):n.next)&&!(o=o.call(n,i[1])).done)return o;switch(n=0,o&&(i=[2&i[0],o.value]),i[0]){case 0:case 1:o=i;break;case 4:return a.label++,{value:i[1],done:!1};case 5:a.label++,n=i[1],i=[0];continue;case 7:i=a.ops.pop(),a.trys.pop();continue;default:if(!((o=(o=a.trys).length>0&&o[o.length-1])||6!==i[0]&&2!==i[0])){a=0;continue}if(3===i[0]&&(!o||i[1]>o[0]&&i[1]<o[3])){a.label=i[1];break}if(6===i[0]&&a.label<o[1]){a.label=o[1],o=i;break}if(o&&a.label<o[2]){a.label=o[2],a.ops.push(i);break}o[2]&&a.ops.pop(),a.trys.pop();continue}i=t.call(e,a)}catch(e){i=[6,e],n=0}finally{r=o=0}if(5&i[0])throw i[1];return{value:i[0]?i[1]:void 0,done:!0}}([i,c])}}}var d=Object.create?function(e,t,r,n){void 0===n&&(n=r),Object.defineProperty(e,n,{enumerable:!0,get:function(){return t[r]}})}:function(e,t,r,n){void 0===n&&(n=r),e[n]=t[r]};function p(e,t){for(var r in e)"default"===r||Object.prototype.hasOwnProperty.call(t,r)||d(t,e,r)}function h(e){var t="function"==typeof Symbol&&Symbol.iterator,r=t&&e[t],n=0;if(r)return r.call(e);if(e&&"number"==typeof e.length)return{next:function(){return e&&n>=e.length&&(e=void 0),{value:e&&e[n++],done:!e}}};throw new TypeError(t?"Object is not iterable.":"Symbol.iterator is not defined.")}function y(e,t){var r="function"==typeof Symbol&&e[Symbol.iterator];if(!r)return e;var n,o,i=r.call(e),a=[];try{for(;(void 0===t||t-- >0)&&!(n=i.next()).done;)a.push(n.value)}catch(e){o={error:e}}finally{try{n&&!n.done&&(r=i.return)&&r.call(i)}finally{if(o)throw o.error}}return a}function g(){for(var e=[],t=0;t<arguments.length;t++)e=e.concat(y(arguments[t]));return e}function b(){for(var e=0,t=0,r=arguments.length;t<r;t++)e+=arguments[t].length;var n=Array(e),o=0;for(t=0;t<r;t++)for(var i=arguments[t],a=0,c=i.length;a<c;a++,o++)n[o]=i[a];return n}function w(e,t){for(var r=0,n=t.length,o=e.length;r<n;r++,o++)e[o]=t[r];return e}function v(e){return this instanceof v?(this.v=e,this):new v(e)}function m(e,t,r){if(!Symbol.asyncIterator)throw new TypeError("Symbol.asyncIterator is not defined.");var n,o=r.apply(e,t||[]),i=[];return n={},a("next"),a("throw"),a("return"),n[Symbol.asyncIterator]=function(){return this},n;function a(e){o[e]&&(n[e]=function(t){return new Promise((function(r,n){i.push([e,t,r,n])>1||c(e,t)}))})}function c(e,t){try{(r=o[e](t)).value instanceof v?Promise.resolve(r.value.v).then(u,s):f(i[0][2],r)}catch(e){f(i[0][3],e)}var r}function u(e){c("next",e)}function s(e){c("throw",e)}function f(e,t){e(t),i.shift(),i.length&&c(i[0][0],i[0][1])}}function _(e){var t,r;return t={},n("next"),n("throw",(function(e){throw e})),n("return"),t[Symbol.iterator]=function(){return this},t;function n(n,o){t[n]=e[n]?function(t){return(r=!r)?{value:v(e[n](t)),done:"return"===n}:o?o(t):t}:o}}function P(e){if(!Symbol.asyncIterator)throw new TypeError("Symbol.asyncIterator is not defined.");var t,r=e[Symbol.asyncIterator];return r?r.call(e):(e=h(e),t={},n("next"),n("throw"),n("return"),t[Symbol.asyncIterator]=function(){return this},t);function n(r){t[r]=e[r]&&function(t){return new Promise((function(n,o){!function(e,t,r,n){Promise.resolve(n).then((function(t){e({value:t,done:r})}),t)}(n,o,(t=e[r](t)).done,t.value)}))}}}function O(e,t){return Object.defineProperty?Object.defineProperty(e,"raw",{value:t}):e.raw=t,e}var S=Object.create?function(e,t){Object.defineProperty(e,"default",{enumerable:!0,value:t})}:function(e,t){e.default=t};function j(e){if(e&&e.__esModule)return e;var t={};if(null!=e)for(var r in e)"default"!==r&&Object.prototype.hasOwnProperty.call(e,r)&&d(t,e,r);return S(t,e),t}function I(e){return e&&e.__esModule?e:{default:e}}function A(e,t,r,n){if("a"===r&&!n)throw new TypeError("Private accessor was defined without a getter");if("function"==typeof t?e!==t||!n:!t.has(e))throw new TypeError("Cannot read private member from an object whose class did not declare it");return"m"===r?n:"a"===r?n.call(e):n?n.value:t.get(e)}function x(e,t,r,n,o){if("m"===n)throw new TypeError("Private method is not writable");if("a"===n&&!o)throw new TypeError("Private accessor was defined without a setter");if("function"==typeof t?e!==t||!o:!t.has(e))throw new TypeError("Cannot write private member to an object whose class did not declare it");return"a"===n?o.call(e,r):o?o.value=r:t.set(e,r),r}}},t={};function r(n){var o=t[n];if(void 0!==o)return o.exports;var i=t[n]={exports:{}};return e[n](i,i.exports,r),i.exports}r.d=(e,t)=>{for(var n in t)r.o(t,n)&&!r.o(e,n)&&Object.defineProperty(e,n,{enumerable:!0,get:t[n]})},r.o=(e,t)=>Object.prototype.hasOwnProperty.call(e,t),r.r=e=>{"undefined"!=typeof Symbol&&Symbol.toStringTag&&Object.defineProperty(e,Symbol.toStringTag,{value:"Module"}),Object.defineProperty(e,"__esModule",{value:!0})},r(607)})();
(()=>{"use strict";var e={607:(e,t,r)=>{Object.defineProperty(t,"__esModule",{value:!0});const n=r(655);n.__exportStar(r(699),t),n.__exportStar(r(882),t),n.__exportStar(r(762),t)},762:(e,t,r)=>{Object.defineProperty(t,"__esModule",{value:!0}),t.JsonReference=t.JsonPointer=void 0;const n=r(882);function o(e){return"object"==typeof e&&null!==e}function i(e){return o(e)&&!d.isReference(e)}function a(e,t,r){const a=new Map,c=[{obj:e,path:[]}];for(;c.length;){const{obj:e,path:u}=c.shift();if(t(r(u),e),i(e))if(a.set(e,new f(n.encodeUriFragmentIdentifier(u))),Array.isArray(e)){let t=-1;const r=e.length;for(;++t<r;){const r=e[t];o(r)&&a.has(r)?c.push({obj:new d(a.get(r)),path:u.concat([t+""])}):c.push({obj:r,path:u.concat([t+""])})}}else{const t=Object.keys(e),r=t.length;let n=-1;for(;++n<r;){const r=e[t[n]];o(r)&&a.has(r)?c.push({obj:new d(a.get(r)),path:u.concat(t[n])}):c.push({obj:r,path:u.concat(t[n])})}}}}const c=Symbol("pointer"),u=Symbol("fragmentId"),s=Symbol("getter");class f{constructor(e){this.path=n.decodePtrInit(e)}static create(e){return new f(e)}static has(e,t){return("string"==typeof t||Array.isArray(t))&&(t=new f(t)),t.has(e)}static get(e,t){return("string"==typeof t||Array.isArray(t))&&(t=new f(t)),t.get(e)}static set(e,t,r,n=!1){return("string"==typeof t||Array.isArray(t))&&(t=new f(t)),t.set(e,r,n)}static unset(e,t){return("string"==typeof t||Array.isArray(t))&&(t=new f(t)),t.unset(e)}static decode(e){return n.pickDecoder(e)(e)}static visit(e,t,r=!1){a(e,t,r?n.encodeUriFragmentIdentifier:n.encodePointer)}static listPointers(e){const t=[];return a(e,((e,r)=>{t.push({pointer:e,value:r})}),n.encodePointer),t}static listFragmentIds(e){const t=[];return a(e,((e,r)=>{t.push({fragmentId:e,value:r})}),n.encodeUriFragmentIdentifier),t}static flatten(e,t=!1){const r={};return a(e,((e,t)=>{r[e]=t}),t?n.encodeUriFragmentIdentifier:n.encodePointer),r}static map(e,t=!1){const r=new Map;return a(e,r.set.bind(r),t?n.encodeUriFragmentIdentifier:n.encodePointer),r}get(e){return this[s]||(this[s]=n.compilePointerDereference(this.path)),this[s](e)}set(e,t,r=!1){return n.setValueAtPath(e,t,this.path,r)}unset(e){return n.unsetValueAtPath(e,this.path)}has(e){return void 0!==this.get(e)}concat(e){return new f(this.path.concat(e instanceof f?e.path:n.decodePtrInit(e)))}get pointer(){return void 0===this[c]&&(this[c]=n.encodePointer(this.path)),this[c]}get uriFragmentIdentifier(){return this[u]||(this[u]=n.encodeUriFragmentIdentifier(this.path)),this[u]}toString(){return this.pointer}}t.JsonPointer=f;const l=Symbol("pointer");class d{constructor(e){this[l]=e instanceof f?e:new f(e),this.$ref=this[l].uriFragmentIdentifier}static isReference(e){if(!e)return!1;const t=e;return"string"==typeof t.$ref&&"function"==typeof t.resolve}resolve(e){return this[l].get(e)}pointer(){return this[l]}toString(){return this.$ref}}t.JsonReference=d},699:(e,t)=>{Object.defineProperty(t,"__esModule",{value:!0})},882:(e,t)=>{function r(e,t,r){let n="",o=e,i=0,a=-1;for(;(a=o.indexOf(t))>-1;)n+=e.substring(i,i+a)+r,o=o.substring(a+t.length,o.length),i+=a+t.length;return o.length>0&&(n+=e.substring(e.length-o.length,e.length)),n}function n(e){let t=-1;const n=e.length,o=new Array(n);for(;++t<n;)"string"==typeof e[t]?o[t]=r(r(decodeURIComponent(e[t]),"~1","/"),"~0","~"):o[t]=e[t];return o}function o(e){let t=-1;const n=e.length,o=new Array(n);for(;++t<n;)"string"==typeof e[t]?o[t]=encodeURIComponent(r(r(e[t],"~","~0"),"/","~1")):o[t]=e[t];return o}function i(e){let t=-1;const n=e.length,o=new Array(n);for(;++t<n;)"string"==typeof e[t]?o[t]=r(r(e[t],"~1","/"),"~0","~"):o[t]=e[t];return o}function a(e){let t=-1;const n=e.length,o=new Array(n);for(;++t<n;)"string"==typeof e[t]?o[t]=r(r(e[t],"~","~0"),"/","~1"):o[t]=e[t];return o}function c(e){if("string"!=typeof e)throw new TypeError("Invalid type: JSON Pointers are represented as strings.");if(0===e.length)return[];if("/"!==e[0])throw new ReferenceError("Invalid JSON Pointer syntax. Non-empty pointer must begin with a solidus `/`.");return i(e.substring(1).split("/"))}function u(e){if("string"!=typeof e)throw new TypeError("Invalid type: JSON Pointers are represented as strings.");if(0===e.length||"#"!==e[0])throw new ReferenceError("Invalid JSON Pointer syntax; URI fragment identifiers must begin with a hash.");if(1===e.length)return[];if("/"!==e[1])throw new ReferenceError("Invalid JSON Pointer syntax.");return n(e.substring(2).split("/"))}function s(e,t){if("number"==typeof t)return t;const r=t.length;if(!r)return-1;let n=0;if(1===r&&"-"===t[0])return Array.isArray(e)?e.length:0;for(;++n<r;)if(t[n]<"0"||t[n]>"9")return-1;return parseInt(t,10)}function f(e){return(null==e?void 0:e.length)>0&&"#"===e[0]}function l(e){return f(e)?u:c}Object.defineProperty(t,"__esModule",{value:!0}),t.decodePtrInit=t.pickDecoder=t.looksLikeFragment=t.unsetValueAtPath=t.setValueAtPath=t.compilePointerDereference=t.toArrayIndexReference=t.encodeUriFragmentIdentifier=t.decodeUriFragmentIdentifier=t.encodePointer=t.decodePointer=t.encodePointerSegments=t.decodePointerSegments=t.encodeFragmentSegments=t.decodeFragmentSegments=t.replace=void 0,t.replace=r,t.decodeFragmentSegments=n,t.encodeFragmentSegments=o,t.decodePointerSegments=i,t.encodePointerSegments=a,t.decodePointer=c,t.encodePointer=function(e){if(!e||e&&!Array.isArray(e))throw new TypeError("Invalid type: path must be an array of segments.");return 0===e.length?"":"/".concat(a(e).join("/"))},t.decodeUriFragmentIdentifier=u,t.encodeUriFragmentIdentifier=function(e){if(!e||e&&!Array.isArray(e))throw new TypeError("Invalid type: path must be an array of segments.");return 0===e.length?"#":"#/".concat(o(e).join("/"))},t.toArrayIndexReference=s,t.compilePointerDereference=function(e){let t="if (typeof(it) !== 'undefined'";return 0===e.length?e=>e:(t=e.reduce(((t,n,o)=>t+"\n\t&& it !== null && typeof((it = it['"+r(r(e[o]+"","\\","\\\\"),"'","\\'")+"'])) !== 'undefined'"),"if (typeof(it) !== 'undefined'"),t+=") {\n\treturn it;\n }",console.log(t),new Function("it",t))},t.setValueAtPath=function(e,t,r,n=!1){if(0===r.length)throw new Error("Cannot set the root object; assign it directly.");if(void 0===e)throw new TypeError("Cannot set values on undefined");let o=e;const i=r.length,a=r.length-1;let c,u,f,l=-1;for(;++l<i;){if(c=r[l],"__proto__"===c||"constructor"===c||"prototype"===c)throw new Error("Attempted prototype pollution disallowed.");if(Array.isArray(o)){if("-"===c&&l===a)return void o.push(t);if(f=s(o,c),o.length>f){if(l===a){u=o[f],o[f]=t;break}o=o[f]}else if(l===a&&f===o.length){if(n)return void o.push(t)}else n&&(o=o[f]=l===a?t:{})}else{if(void 0===o[c]){if(n){if(l===a)return void(o[c]=t);if(-1!==s(o[c],r[l+1])){o=o[c]=[];continue}o=o[c]={};continue}return}if(l===a){u=o[c],o[c]=t;break}o=o[c]}}return u},t.unsetValueAtPath=function(e,t){if(0===t.length)throw new Error("Cannot unset the root object; assign it directly.");if(void 0===e)throw new TypeError("Cannot unset values on undefined");let r=e;const n=t.length,o=t.length-1;let i,a,c,u=-1;for(;++u<n;)if(i=t[u],Array.isArray(r)){if(c=s(r,i),c>=r.length)return;if(u===o){a=r[c],delete r[c];break}r=r[c]}else{if(void 0===r[i])return;if(u===o){a=r[i],delete r[i];break}r=r[i]}return a},t.looksLikeFragment=f,t.pickDecoder=l,t.decodePtrInit=function(e){return Array.isArray(e)?e.slice(0):l(e)(e)}},655:(e,t,r)=>{r.r(t),r.d(t,{__extends:()=>o,__assign:()=>i,__rest:()=>a,__decorate:()=>c,__param:()=>u,__metadata:()=>s,__awaiter:()=>f,__generator:()=>l,__createBinding:()=>d,__exportStar:()=>p,__values:()=>h,__read:()=>y,__spread:()=>g,__spreadArrays:()=>b,__spreadArray:()=>w,__await:()=>v,__asyncGenerator:()=>m,__asyncDelegator:()=>_,__asyncValues:()=>P,__makeTemplateObject:()=>O,__importStar:()=>j,__importDefault:()=>I,__classPrivateFieldGet:()=>A,__classPrivateFieldSet:()=>x});var n=function(e,t){return(n=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(e,t){e.__proto__=t}||function(e,t){for(var r in t)Object.prototype.hasOwnProperty.call(t,r)&&(e[r]=t[r])})(e,t)};function o(e,t){if("function"!=typeof t&&null!==t)throw new TypeError("Class extends value "+String(t)+" is not a constructor or null");function r(){this.constructor=e}n(e,t),e.prototype=null===t?Object.create(t):(r.prototype=t.prototype,new r)}var i=function(){return(i=Object.assign||function(e){for(var t,r=1,n=arguments.length;r<n;r++)for(var o in t=arguments[r])Object.prototype.hasOwnProperty.call(t,o)&&(e[o]=t[o]);return e}).apply(this,arguments)};function a(e,t){var r={};for(var n in e)Object.prototype.hasOwnProperty.call(e,n)&&t.indexOf(n)<0&&(r[n]=e[n]);if(null!=e&&"function"==typeof Object.getOwnPropertySymbols){var o=0;for(n=Object.getOwnPropertySymbols(e);o<n.length;o++)t.indexOf(n[o])<0&&Object.prototype.propertyIsEnumerable.call(e,n[o])&&(r[n[o]]=e[n[o]])}return r}function c(e,t,r,n){var o,i=arguments.length,a=i<3?t:null===n?n=Object.getOwnPropertyDescriptor(t,r):n;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)a=Reflect.decorate(e,t,r,n);else for(var c=e.length-1;c>=0;c--)(o=e[c])&&(a=(i<3?o(a):i>3?o(t,r,a):o(t,r))||a);return i>3&&a&&Object.defineProperty(t,r,a),a}function u(e,t){return function(r,n){t(r,n,e)}}function s(e,t){if("object"==typeof Reflect&&"function"==typeof Reflect.metadata)return Reflect.metadata(e,t)}function f(e,t,r,n){return new(r||(r=Promise))((function(o,i){function a(e){try{u(n.next(e))}catch(e){i(e)}}function c(e){try{u(n.throw(e))}catch(e){i(e)}}function u(e){var t;e.done?o(e.value):(t=e.value,t instanceof r?t:new r((function(e){e(t)}))).then(a,c)}u((n=n.apply(e,t||[])).next())}))}function l(e,t){var r,n,o,i,a={label:0,sent:function(){if(1&o[0])throw o[1];return o[1]},trys:[],ops:[]};return i={next:c(0),throw:c(1),return:c(2)},"function"==typeof Symbol&&(i[Symbol.iterator]=function(){return this}),i;function c(i){return function(c){return function(i){if(r)throw new TypeError("Generator is already executing.");for(;a;)try{if(r=1,n&&(o=2&i[0]?n.return:i[0]?n.throw||((o=n.return)&&o.call(n),0):n.next)&&!(o=o.call(n,i[1])).done)return o;switch(n=0,o&&(i=[2&i[0],o.value]),i[0]){case 0:case 1:o=i;break;case 4:return a.label++,{value:i[1],done:!1};case 5:a.label++,n=i[1],i=[0];continue;case 7:i=a.ops.pop(),a.trys.pop();continue;default:if(!((o=(o=a.trys).length>0&&o[o.length-1])||6!==i[0]&&2!==i[0])){a=0;continue}if(3===i[0]&&(!o||i[1]>o[0]&&i[1]<o[3])){a.label=i[1];break}if(6===i[0]&&a.label<o[1]){a.label=o[1],o=i;break}if(o&&a.label<o[2]){a.label=o[2],a.ops.push(i);break}o[2]&&a.ops.pop(),a.trys.pop();continue}i=t.call(e,a)}catch(e){i=[6,e],n=0}finally{r=o=0}if(5&i[0])throw i[1];return{value:i[0]?i[1]:void 0,done:!0}}([i,c])}}}var d=Object.create?function(e,t,r,n){void 0===n&&(n=r),Object.defineProperty(e,n,{enumerable:!0,get:function(){return t[r]}})}:function(e,t,r,n){void 0===n&&(n=r),e[n]=t[r]};function p(e,t){for(var r in e)"default"===r||Object.prototype.hasOwnProperty.call(t,r)||d(t,e,r)}function h(e){var t="function"==typeof Symbol&&Symbol.iterator,r=t&&e[t],n=0;if(r)return r.call(e);if(e&&"number"==typeof e.length)return{next:function(){return e&&n>=e.length&&(e=void 0),{value:e&&e[n++],done:!e}}};throw new TypeError(t?"Object is not iterable.":"Symbol.iterator is not defined.")}function y(e,t){var r="function"==typeof Symbol&&e[Symbol.iterator];if(!r)return e;var n,o,i=r.call(e),a=[];try{for(;(void 0===t||t-- >0)&&!(n=i.next()).done;)a.push(n.value)}catch(e){o={error:e}}finally{try{n&&!n.done&&(r=i.return)&&r.call(i)}finally{if(o)throw o.error}}return a}function g(){for(var e=[],t=0;t<arguments.length;t++)e=e.concat(y(arguments[t]));return e}function b(){for(var e=0,t=0,r=arguments.length;t<r;t++)e+=arguments[t].length;var n=Array(e),o=0;for(t=0;t<r;t++)for(var i=arguments[t],a=0,c=i.length;a<c;a++,o++)n[o]=i[a];return n}function w(e,t){for(var r=0,n=t.length,o=e.length;r<n;r++,o++)e[o]=t[r];return e}function v(e){return this instanceof v?(this.v=e,this):new v(e)}function m(e,t,r){if(!Symbol.asyncIterator)throw new TypeError("Symbol.asyncIterator is not defined.");var n,o=r.apply(e,t||[]),i=[];return n={},a("next"),a("throw"),a("return"),n[Symbol.asyncIterator]=function(){return this},n;function a(e){o[e]&&(n[e]=function(t){return new Promise((function(r,n){i.push([e,t,r,n])>1||c(e,t)}))})}function c(e,t){try{(r=o[e](t)).value instanceof v?Promise.resolve(r.value.v).then(u,s):f(i[0][2],r)}catch(e){f(i[0][3],e)}var r}function u(e){c("next",e)}function s(e){c("throw",e)}function f(e,t){e(t),i.shift(),i.length&&c(i[0][0],i[0][1])}}function _(e){var t,r;return t={},n("next"),n("throw",(function(e){throw e})),n("return"),t[Symbol.iterator]=function(){return this},t;function n(n,o){t[n]=e[n]?function(t){return(r=!r)?{value:v(e[n](t)),done:"return"===n}:o?o(t):t}:o}}function P(e){if(!Symbol.asyncIterator)throw new TypeError("Symbol.asyncIterator is not defined.");var t,r=e[Symbol.asyncIterator];return r?r.call(e):(e=h(e),t={},n("next"),n("throw"),n("return"),t[Symbol.asyncIterator]=function(){return this},t);function n(r){t[r]=e[r]&&function(t){return new Promise((function(n,o){!function(e,t,r,n){Promise.resolve(n).then((function(t){e({value:t,done:r})}),t)}(n,o,(t=e[r](t)).done,t.value)}))}}}function O(e,t){return Object.defineProperty?Object.defineProperty(e,"raw",{value:t}):e.raw=t,e}var S=Object.create?function(e,t){Object.defineProperty(e,"default",{enumerable:!0,value:t})}:function(e,t){e.default=t};function j(e){if(e&&e.__esModule)return e;var t={};if(null!=e)for(var r in e)"default"!==r&&Object.prototype.hasOwnProperty.call(e,r)&&d(t,e,r);return S(t,e),t}function I(e){return e&&e.__esModule?e:{default:e}}function A(e,t,r,n){if("a"===r&&!n)throw new TypeError("Private accessor was defined without a getter");if("function"==typeof t?e!==t||!n:!t.has(e))throw new TypeError("Cannot read private member from an object whose class did not declare it");return"m"===r?n:"a"===r?n.call(e):n?n.value:t.get(e)}function x(e,t,r,n,o){if("m"===n)throw new TypeError("Private method is not writable");if("a"===n&&!o)throw new TypeError("Private accessor was defined without a setter");if("function"==typeof t?e!==t||!o:!t.has(e))throw new TypeError("Cannot write private member to an object whose class did not declare it");return"a"===n?o.call(e,r):o?o.value=r:t.set(e,r),r}}},t={};function r(n){var o=t[n];if(void 0!==o)return o.exports;var i=t[n]={exports:{}};return e[n](i,i.exports,r),i.exports}r.d=(e,t)=>{for(var n in t)r.o(t,n)&&!r.o(e,n)&&Object.defineProperty(e,n,{enumerable:!0,get:t[n]})},r.o=(e,t)=>Object.prototype.hasOwnProperty.call(e,t),r.r=e=>{"undefined"!=typeof Symbol&&Symbol.toStringTag&&Object.defineProperty(e,Symbol.toStringTag,{value:"Module"}),Object.defineProperty(e,"__esModule",{value:!0})},r(607)})();

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

return (body +
" && \n\ttypeof((it = it['" +
"\n\t&& it !== null && typeof((it = it['" +
replace(replace(path[i] + '', '\\', '\\\\'), "'", "\\'") +

@@ -163,2 +163,3 @@ "'])) !== 'undefined'");

body = body + ') {\n\treturn it;\n }';
console.log(body);
return new Function('it', body);

@@ -165,0 +166,0 @@ }

{
"name": "json-ptr",
"version": "2.1.1-master.6efd1ec",
"version": "2.1.1-master.98922c7",
"author": "Phillip Clark <phillip@flitbit.com>",

@@ -5,0 +5,0 @@ "description": "A complete implementation of JSON Pointer (RFC 6901) for nodejs and modern browsers.",

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

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