object-unpacker
Advanced tools
Comparing version 0.0.16 to 0.0.17
@@ -1,1 +0,1 @@ | ||
!function(e,t){"object"==typeof exports&&"object"==typeof module?module.exports=t():"function"==typeof define&&define.amd?define([],t):"object"==typeof exports?exports.ObjectUnpacker=t():e.ObjectUnpacker=t()}(self,(function(){return(()=>{var e={43:function(e,t,r){var n,o;!function(i,a){"use strict";void 0===(o="function"==typeof(n=function(){var e=function(){},t="undefined",r=typeof window!==t&&typeof window.navigator!==t&&/Trident\/|MSIE /.test(window.navigator.userAgent),n=["trace","debug","info","warn","error"];function o(e,t){var r=e[t];if("function"==typeof r.bind)return r.bind(e);try{return Function.prototype.bind.call(r,e)}catch(t){return function(){return Function.prototype.apply.apply(r,[e,arguments])}}}function i(){console.log&&(console.log.apply?console.log.apply(console,arguments):Function.prototype.apply.apply(console.log,[console,arguments])),console.trace&&console.trace()}function a(n){return"debug"===n&&(n="log"),typeof console!==t&&("trace"===n&&r?i:void 0!==console[n]?o(console,n):void 0!==console.log?o(console,"log"):e)}function s(t,r){for(var o=0;o<n.length;o++){var i=n[o];this[i]=o<t?e:this.methodFactory(i,t,r)}this.log=this.debug}function u(e,r,n){return function(){typeof console!==t&&(s.call(this,r,n),this[e].apply(this,arguments))}}function l(e,t,r){return a(e)||u.apply(this,arguments)}function c(e,r,o){var i,a=this,u="loglevel";function c(){var e;if(typeof window!==t&&u){try{e=window.localStorage[u]}catch(e){}if(typeof e===t)try{var r=window.document.cookie,n=r.indexOf(encodeURIComponent(u)+"=");-1!==n&&(e=/^([^;]+)/.exec(r.slice(n))[1])}catch(e){}return void 0===a.levels[e]&&(e=void 0),e}}"string"==typeof e?u+=":"+e:"symbol"==typeof e&&(u=void 0),a.name=e,a.levels={TRACE:0,DEBUG:1,INFO:2,WARN:3,ERROR:4,SILENT:5},a.methodFactory=o||l,a.getLevel=function(){return i},a.setLevel=function(r,o){if("string"==typeof r&&void 0!==a.levels[r.toUpperCase()]&&(r=a.levels[r.toUpperCase()]),!("number"==typeof r&&r>=0&&r<=a.levels.SILENT))throw"log.setLevel() called with invalid level: "+r;if(i=r,!1!==o&&function(e){var r=(n[e]||"silent").toUpperCase();if(typeof window!==t&&u){try{return void(window.localStorage[u]=r)}catch(e){}try{window.document.cookie=encodeURIComponent(u)+"="+r+";"}catch(e){}}}(r),s.call(a,r,e),typeof console===t&&r<a.levels.SILENT)return"No console available for logging"},a.setDefaultLevel=function(e){c()||a.setLevel(e,!1)},a.enableAll=function(e){a.setLevel(a.levels.TRACE,e)},a.disableAll=function(e){a.setLevel(a.levels.SILENT,e)};var f=c();null==f&&(f=null==r?"WARN":r),a.setLevel(f,!1)}var f=new c,y={};f.getLogger=function(e){if("symbol"!=typeof e&&"string"!=typeof e||""===e)throw new TypeError("You must supply a name when creating a logger.");var t=y[e];return t||(t=y[e]=new c(e,f.getLevel(),f.methodFactory)),t};var p=typeof window!==t?window.log:void 0;return f.noConflict=function(){return typeof window!==t&&window.log===f&&(window.log=p),f},f.getLoggers=function(){return y},f.default=f,f})?n.call(t,r,t,e):n)||(e.exports=o)}()},616:function(e,t,r){"use strict";var n=this&&this.__importDefault||function(e){return e&&e.__esModule?e:{default:e}};Object.defineProperty(t,"__esModule",{value:!0}),t.createObjectUnpacker=void 0;var o=n(r(43)),i=r(980),a=r(27),s=r(102);t.createObjectUnpacker=function(){return new y};var u="%",l="%",c=!0,f=i.createReferencesResolver(),y=function(){function e(){}return e.prototype.convert=function(e,t,r){try{var n=p(r),a=s.transform(t,s.prefixReferences),y=new Map;s.indexObject(u,l,c,i.INDEX_NAMESPACE,y,a["?"]),s.indexObject(u,l,c,i.COMPACT_NAMESPACE,y,a),s.indexObject(u,l,c,i.SUBS_NAMESPACE,y,e);var d=v(a,n,y);return delete d["?"],f.resolve(y,d)}catch(e){return o.default.error(e.message),{error:e.message}}},e}(),p=function(e){var t=new Map;return Object.keys(e).forEach((function(r){t.set(r,new a.TransformationInstruction(r,e[r]))})),t},v=function(e,t,r){if(null===e)return null;if(Array.isArray(e))return e.map((function(e){return v(e,t,r)}));if("object"==typeof e){var n={};return Object.keys(e).forEach((function(o){var i=t.get(o);if(i&&i.additionalKeys&&i.additionalKeys.has(o)&&(i=i.additionalKeys.get(o)),i){if(i.isRemovePair())return;var a="object"!=typeof e[o]&&i.assignKeys?[e[o]]:e[o],f=d(a,i,t,r);"string"==typeof f&&f.includes("%self")&&(f=M(a,f));var y=i.transformKey(o);if(i.replacePair)S(f)&&P(f,n);else if(i.rewriteValue)if(i.resultValue)if("object"==typeof i.resultValue)n[y]=d(a,i,t,r);else if("string"==typeof i.resultValue&&i.resultValue.startsWith("%")){var p=new Map;r.forEach((function(e,t){return p.set(t,e)})),s.indexObject(u,l,c,"",p,a),n[y]=d(a,i,t,p)}else n[y]=f;else n[y]=null;else n[y]=f}else r.has(o)?n[o]=r.get(o):n[o]=v(e[o],t,r)})),n}return e},d=function(e,t,r,n){if(null===e)return e;var o=S(e)?_(e,t,n):e,i=Array.isArray(o)&&t.assignKeys?g(t.assignKeys,o):new Map,a=new Map;if(n.forEach((function(e,t){return a.set(t,e)})),s.indexObject(u,l,c,"",a,h(i)),t.isArrayMapping()){if(Array.isArray(o)){var f=t.arrayItemsName,y=f?w(f,o):o;return t.assignKeys?g(t.assignKeys,y):v(y,r,a)}throw new Error('"arrayItems" can only be applied to arrays.')}if(!t.resultValue)return i.size>0?v(h(i),r,a):v(o,r,a);switch(typeof t.resultValue){case"object":return Array.isArray(t.resultValue)?A(t,r,a):b(t,o,r,a,i);case"string":return"%self"===t.resultValue?v(o,r,a):t.resultValue.match("^%[a-zA-Z]+(.[a-zA-Z]+)*$")?a.get(t.resultValue):v(t.resultValue,r,a);default:return t.resultValue}},h=function(e){var t={};return e.forEach((function(e,r){return t[r]=e})),t},g=function(e,t){var r=new Map;return Array.isArray(t)?e.forEach((function(e,n){n<t.length?r.set(e,t[n]):r.set(e,null)})):"object"==typeof t?e.forEach((function(e){r.set(e,t[e])})):e.forEach((function(e,n){0===n?r.set(e,t):r.set(e,null)})),r},w=function(e,t){return t.map((function(t){var r={};return r[e]=t,r}))},b=function(e,t,r,n,o){var i={},a=e.resultValue?e.resultValue:t;return Object.keys(a).forEach((function(e){var s=v(a[e],r,n);if("string"==typeof s){var u=s;if(E(t,u))"object"==typeof(l=t[u.substr(1)])?j(l,r,u)?i[e]=d(l,r.get(u.substr(1)),r,n):i[e]=v(l,r,n):i[e]=l;else if(m(u,o)){var l;(l=o.get(u.substr(1)))&&"object"==typeof l?j(l,r,u)?i[e]=d(l,r.get(u.substr(1)),r,n):i[e]=v(l,r,n):i[e]=l}else O(u)?i[e]=f.resolve(n,s):u.includes("%self")?i[e]=M(t,u):n.has(u)?i[e]=n.get(u):i[e]=null}else N(s)?i[e]=f.resolve(n,s):i[e]=s})),i},A=function(e,t,r){return e.resultValue&&Array.isArray(e.resultValue)?e.resultValue.map((function(n){return d(n,e,t,r)})).filter((function(e){return null!==e})):[]},E=function(e,t){return"object"==typeof e&&"%"===t.charAt(0)&&e.hasOwnProperty(t.substr(1))},m=function(e,t){return"%"===e.charAt(0)&&t.has(e.substr(1))},j=function(e,t,r){return Array.isArray(e)&&t.has(r.substr(1))},O=function(e){return e.startsWith("%/")||!e.startsWith("%")&&!e.includes("%self")},N=function(e){return null!==e&&"object"==typeof e},M=function(e,t){var r=new Map;return r.set("%self",e),r.set("%self%",e),f.resolve(r,t)},S=function(e){return null!==e&&!Array.isArray(e)&&"object"==typeof e},P=function(e,t){Object.keys(e).forEach((function(r){t[r]=e[r]}))},_=function(e,t,r){var n=e,o={};for(var i in n)if(t.additionalKeys.has(i)){var a=t.additionalKeys.get(i);o[a.transformKey(i)]=v(n[i],a.additionalKeys,r)}else o[i]=n[i];return o}},980:(e,t)=>{"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.FIND_REFS=t.SUBS_NAMESPACE=t.COMPACT_NAMESPACE=t.INDEX_NAMESPACE=t.createReferencesResolver=void 0,t.createReferencesResolver=function(){return new r},t.INDEX_NAMESPACE="/index",t.COMPACT_NAMESPACE="/compact",t.SUBS_NAMESPACE="/subs",t.FIND_REFS=new RegExp(/%?%[\w-./@]+%?/gm);var r=function(){function e(){}return e.prototype.resolve=function(e,t){if(null==t)throw new Error("Cannot dereference an undefined dataObject.");if("string"==typeof t)return i(e,t);var r=Array.isArray(t["?"])?t["?"]:[t["?"]];return r&&r.forEach((function(t,r){e.set("%"+r,t),e.set("%"+r+"%",t)})),Array.isArray(t)?n("",e,t):o("",e,t)},e}(),n=function(e,t,r){var a=[];return r.forEach((function(r,s){var u=e+"."+s;Array.isArray(r)?a.push(n(u,t,r)):"object"==typeof r?a.push(o(u,t,r)):"string"==typeof r?a.push(i(t,r)):a.push(r)})),a},o=function(e,t,r){if(null===r)return null;var a={};return Object.keys(r).forEach((function(s){var u=r[s];if(null!==u){var l=e+"."+s;Array.isArray(u)?a[s]=n(l,t,u):a[s]="object"==typeof u?o(l,t,u):"string"==typeof u?i(t,u):u}else a[s]=null})),a},i=function(e,r){for(var n=r,o=[],i=t.FIND_REFS.exec(n);null!==i;){var a=i[0];o.push(a),i=t.FIND_REFS.exec(n)}return o.forEach((function(t){if(!t.startsWith("%%")){var r=e.get(t);n=r&&"string"==typeof n?n===t?r:n.replace(t,""+r):n===t?null:n.replace(t,"")}})),"string"==typeof n?n.replace("%%","%"):n}},27:(e,t)=>{"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.TransformationInstruction=void 0;var r=["rewriteValue","assignKeys","rewriteKey","replacePair","arrayItems"],n=function(){function e(t,n){var o=this;this.key=t,this.rewriteValue=!!n.hasOwnProperty("rewriteValue"),this.replacePair=!!n.hasOwnProperty("replacePair"),this.assignKeys=n.assignKeys?n.assignKeys:null,this.resultValue=n.rewriteValue?n.rewriteValue:n.replacePair,this.rewriteKey=n.rewriteKey?n.rewriteKey:null,this.arrayItemsName=n.arrayItems?n.arrayItems:null,this.additionalKeys=new Map,Object.keys(n).filter((function(e){return!r.includes(e)})).forEach((function(t){o.additionalKeys.set(t,new e(t,n[t]))}))}return e.prototype.transformKey=function(e){return this.rewriteKey?this.rewriteKey:e},e.prototype.shouldRewriteValue=function(){return this.rewriteValue},e.prototype.isArrayMapping=function(){return null!==this.arrayItemsName},e.prototype.isRemovePair=function(){return!this.replacePair&&!this.rewriteValue&&null===this.arrayItemsName&&null===this.assignKeys&&null===this.rewriteKey&&void 0===this.resultValue&&0===this.additionalKeys.size},e}();t.TransformationInstruction=n},102:(e,t,r)=>{"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.identity=t.prefixReferences=t.transform=t.indexObject=void 0;var n=r(980);t.indexObject=function(e,r,n,o,i,a){a&&Object.entries(a).forEach((function(a){var s=o.length>0?o+"."+a[0]:""+a[0];n&&i.set(e+s,a[1]),i.set(e+s+r,a[1]),"object"==typeof a[1]&&t.indexObject(e,r,n,s,i,a[1])}))},t.transform=function(e,r){if(!e)return r(e);if(Array.isArray(e)){var n=[];return e.forEach((function(e){"object"==typeof e?n.push(t.transform(e,r)):n.push(r(e))})),r(n)}if("object"==typeof e){var o={};return Object.entries(e).forEach((function(e){"object"==typeof e[1]?o[e[0]]=t.transform(e[1],r):o[e[0]]=r(e[1])})),r(o)}return r(e)},t.prefixReferences=function(e){return"string"!=typeof e?e:e.replace(n.FIND_REFS,(function(e){if(e.startsWith("%%"))return e;var t=e.charCodeAt(1);return t>47&&t<58?"%"+n.INDEX_NAMESPACE+"."+e.substr(1):"%"+n.SUBS_NAMESPACE+"."+e.substr(1)}))},t.identity=function(e){return e}}},t={};function r(n){if(t[n])return t[n].exports;var o=t[n]={exports:{}};return e[n].call(o.exports,o,o.exports,r),o.exports}var n={};return(()=>{"use strict";var e=n;Object.defineProperty(e,"__esModule",{value:!0}),e.mapper=void 0;var t=r(616);e.mapper=t.createObjectUnpacker()})(),n})()})); | ||
!function(e,r){"object"==typeof exports&&"object"==typeof module?module.exports=r():"function"==typeof define&&define.amd?define([],r):"object"==typeof exports?exports.ObjectUnpacker=r():e.ObjectUnpacker=r()}(self,(function(){return(()=>{var e={43:function(e,r,t){var n,o;!function(i,a){"use strict";void 0===(o="function"==typeof(n=function(){var e=function(){},r="undefined",t=typeof window!==r&&typeof window.navigator!==r&&/Trident\/|MSIE /.test(window.navigator.userAgent),n=["trace","debug","info","warn","error"];function o(e,r){var t=e[r];if("function"==typeof t.bind)return t.bind(e);try{return Function.prototype.bind.call(t,e)}catch(r){return function(){return Function.prototype.apply.apply(t,[e,arguments])}}}function i(){console.log&&(console.log.apply?console.log.apply(console,arguments):Function.prototype.apply.apply(console.log,[console,arguments])),console.trace&&console.trace()}function a(n){return"debug"===n&&(n="log"),typeof console!==r&&("trace"===n&&t?i:void 0!==console[n]?o(console,n):void 0!==console.log?o(console,"log"):e)}function s(r,t){for(var o=0;o<n.length;o++){var i=n[o];this[i]=o<r?e:this.methodFactory(i,r,t)}this.log=this.debug}function u(e,t,n){return function(){typeof console!==r&&(s.call(this,t,n),this[e].apply(this,arguments))}}function l(e,r,t){return a(e)||u.apply(this,arguments)}function c(e,t,o){var i,a=this,u="loglevel";function c(){var e;if(typeof window!==r&&u){try{e=window.localStorage[u]}catch(e){}if(typeof e===r)try{var t=window.document.cookie,n=t.indexOf(encodeURIComponent(u)+"=");-1!==n&&(e=/^([^;]+)/.exec(t.slice(n))[1])}catch(e){}return void 0===a.levels[e]&&(e=void 0),e}}"string"==typeof e?u+=":"+e:"symbol"==typeof e&&(u=void 0),a.name=e,a.levels={TRACE:0,DEBUG:1,INFO:2,WARN:3,ERROR:4,SILENT:5},a.methodFactory=o||l,a.getLevel=function(){return i},a.setLevel=function(t,o){if("string"==typeof t&&void 0!==a.levels[t.toUpperCase()]&&(t=a.levels[t.toUpperCase()]),!("number"==typeof t&&t>=0&&t<=a.levels.SILENT))throw"log.setLevel() called with invalid level: "+t;if(i=t,!1!==o&&function(e){var t=(n[e]||"silent").toUpperCase();if(typeof window!==r&&u){try{return void(window.localStorage[u]=t)}catch(e){}try{window.document.cookie=encodeURIComponent(u)+"="+t+";"}catch(e){}}}(t),s.call(a,t,e),typeof console===r&&t<a.levels.SILENT)return"No console available for logging"},a.setDefaultLevel=function(e){c()||a.setLevel(e,!1)},a.enableAll=function(e){a.setLevel(a.levels.TRACE,e)},a.disableAll=function(e){a.setLevel(a.levels.SILENT,e)};var f=c();null==f&&(f=null==t?"WARN":t),a.setLevel(f,!1)}var f=new c,p={};f.getLogger=function(e){if("symbol"!=typeof e&&"string"!=typeof e||""===e)throw new TypeError("You must supply a name when creating a logger.");var r=p[e];return r||(r=p[e]=new c(e,f.getLevel(),f.methodFactory)),r};var y=typeof window!==r?window.log:void 0;return f.noConflict=function(){return typeof window!==r&&window.log===f&&(window.log=y),f},f.getLoggers=function(){return p},f.default=f,f})?n.call(r,t,r,e):n)||(e.exports=o)}()},616:function(e,r,t){"use strict";var n=this&&this.__importDefault||function(e){return e&&e.__esModule?e:{default:e}};Object.defineProperty(r,"__esModule",{value:!0}),r.createObjectUnpacker=void 0;var o=n(t(43)),i=t(980),a=t(27),s=t(102);r.createObjectUnpacker=function(){return new p};var u="%",l="%",c=!0,f=i.createReferencesResolver(),p=function(){function e(){}return e.prototype.convert=function(e,r,t){try{var n=y(t),a=s.transform(r,s.prefixReferences),p=new Map;s.indexObject(u,l,c,i.INDEX_NAMESPACE,p,a["?"]),s.indexObject(u,l,c,i.COMPACT_NAMESPACE,p,a),s.indexObject(u,l,c,i.SUBS_NAMESPACE,p,e);var v=d(a,n,p);return delete v["?"],f.resolve(p,v)}catch(e){return o.default.error(e.message),{error:e.message}}},e}(),y=function(e){var r=new Map;return Object.keys(e).forEach((function(t){r.set(t,new a.TransformationInstruction(t,e[t]))})),r},d=function(e,r,t){if(null===e)return null;if(Array.isArray(e))return e.map((function(e){return d(e,r,t)}));if("object"==typeof e){var n={};return Object.keys(e).forEach((function(o){var i=r.get(o);if(i&&i.additionalKeys&&i.additionalKeys.has(o)&&(i=i.additionalKeys.get(o)),i){if(i.isRemovePair())return;var a="object"!=typeof e[o]&&i.assignKeys?[e[o]]:e[o],f=v(a,i,r,t);"string"==typeof f&&f.includes("%self")&&(f=N(a,f));var p=i.transformKey(o);if(i.replacePair)S(f)&&P(f,n);else if(i.rewriteValue)if(i.resultValue)if("object"==typeof i.resultValue)n[p]=v(a,i,r,t);else if("string"==typeof i.resultValue&&i.resultValue.startsWith("%")){var y=new Map;t.forEach((function(e,r){return y.set(r,e)})),s.indexObject(u,l,c,"",y,a),n[p]=v(a,i,r,y)}else n[p]=f;else n[p]=null;else n[p]=f}else t.has(o)?n[o]=t.get(o):n[o]=d(e[o],r,t)})),n}return e},v=function(e,r,t,n){if(null===e)return e;var o=S(e)?_(e,r,n):e,i=Array.isArray(o)&&r.assignKeys?g(r.assignKeys,o):new Map,a=new Map;if(n.forEach((function(e,r){return a.set(r,e)})),s.indexObject(u,l,c,"",a,h(i)),r.isArrayMapping()){if(Array.isArray(o)){var f=r.arrayItemsName,p=f?b(f,o):o;return r.assignKeys?g(r.assignKeys,p):d(p,t,a)}throw new Error('"arrayItems" can only be applied to arrays.')}if(!r.resultValue)return i.size>0?d(h(i),t,a):d(o,t,a);switch(typeof r.resultValue){case"object":return Array.isArray(r.resultValue)?A(r,t,a):w(r,o,t,a,i);case"string":return"%self"===r.resultValue?d(o,t,a):r.resultValue.match("^%[a-zA-Z]+(.[a-zA-Z]+)*$")?a.get(r.resultValue):d(r.resultValue,t,a);default:return r.resultValue}},h=function(e){var r={};return e.forEach((function(e,t){return r[t]=e})),r},g=function(e,r){var t=new Map;return Array.isArray(r)?e.forEach((function(e,n){n<r.length?t.set(e,r[n]):t.set(e,null)})):"object"==typeof r?e.forEach((function(e){t.set(e,r[e])})):e.forEach((function(e,n){0===n?t.set(e,r):t.set(e,null)})),t},b=function(e,r){return r.map((function(r){var t={};return t[e]=r,t}))},w=function(e,r,t,n,o){var i={},a=e.resultValue?e.resultValue:r;return Object.keys(a).forEach((function(e){var p=d(a[e],t,n);if("string"==typeof p){var y=p;if(E(r,y))"object"==typeof(h=r[y.substr(1)])?j(h,t,y)?i[e]=v(h,t.get(y.substr(1)),t,n):i[e]=d(h,t,n):i[e]=h;else if(m(y,o)){var h;(h=o.get(y.substr(1)))&&"object"==typeof h?j(h,t,y)?i[e]=v(h,t.get(y.substr(1)),t,n):i[e]=d(h,t,n):i[e]=h}else if(O(y)){var g=new Map;n.forEach((function(e,r){return g.set(r,e)})),s.indexObject(u,l,c,"",g,r),i[e]=f.resolve(g,p)}else y.includes("%self")?i[e]=N(r,y):n.has(y)?i[e]=n.get(y):i[e]=null}else M(p)?i[e]=f.resolve(n,p):i[e]=p})),i},A=function(e,r,t){return e.resultValue&&Array.isArray(e.resultValue)?e.resultValue.map((function(n){return v(n,e,r,t)})).filter((function(e){return null!==e})):[]},E=function(e,r){return"object"==typeof e&&"%"===r.charAt(0)&&e.hasOwnProperty(r.substr(1))},m=function(e,r){return"%"===e.charAt(0)&&r.has(e.substr(1))},j=function(e,r,t){return Array.isArray(e)&&r.has(t.substr(1))},O=function(e){return e.startsWith("%/")||!e.startsWith("%")&&!e.includes("%self")},M=function(e){return null!==e&&"object"==typeof e},N=function(e,r){var t=new Map;return t.set("%self",e),t.set("%self%",e),f.resolve(t,r)},S=function(e){return null!==e&&!Array.isArray(e)&&"object"==typeof e},P=function(e,r){Object.keys(e).forEach((function(t){r[t]=e[t]}))},_=function(e,r,t){var n=e,o={};for(var i in n)if(r.additionalKeys.has(i)){var a=r.additionalKeys.get(i);o[a.transformKey(i)]=d(n[i],a.additionalKeys,t)}else o[i]=n[i];return o}},980:(e,r)=>{"use strict";Object.defineProperty(r,"__esModule",{value:!0}),r.FIND_REFS=r.SUBS_NAMESPACE=r.COMPACT_NAMESPACE=r.INDEX_NAMESPACE=r.createReferencesResolver=void 0,r.createReferencesResolver=function(){return new t},r.INDEX_NAMESPACE="/index",r.COMPACT_NAMESPACE="/compact",r.SUBS_NAMESPACE="/subs",r.FIND_REFS=new RegExp(/%?%[\w-./@]+%?/gm);var t=function(){function e(){}return e.prototype.resolve=function(e,r){if(null==r)throw new Error("Cannot dereference an undefined dataObject.");if("string"==typeof r)return i(e,r);var t=Array.isArray(r["?"])?r["?"]:[r["?"]];return t&&t.forEach((function(r,t){e.set("%"+t,r),e.set("%"+t+"%",r)})),Array.isArray(r)?n("",e,r):o("",e,r)},e}(),n=function(e,r,t){var a=[];return t.forEach((function(t,s){var u=e+"."+s;Array.isArray(t)?a.push(n(u,r,t)):"object"==typeof t?a.push(o(u,r,t)):"string"==typeof t?a.push(i(r,t)):a.push(t)})),a},o=function(e,r,t){if(null===t)return null;var a={};return Object.keys(t).forEach((function(s){var u=t[s];if(null!==u){var l=e+"."+s;Array.isArray(u)?a[s]=n(l,r,u):a[s]="object"==typeof u?o(l,r,u):"string"==typeof u?i(r,u):u}else a[s]=null})),a},i=function(e,t){for(var n=t,o=[],i=r.FIND_REFS.exec(n);null!==i;){var s=i[0];o.push(s),i=r.FIND_REFS.exec(n)}return o.forEach((function(r){if(!r.startsWith("%%")){var t=e.get(r);if(null!=t&&"string"==typeof n)if(n===r)n=t;else if("object"==typeof t){var o=a(r);console.error(o+" refers to an object or array and cannot be embedded in a string"),n=n.replace(r,""+o)}else n=n.replace(r,""+t);else n=n===r?null:n.replace(r,"")}})),"string"==typeof n?n.replace("%%","%"):n},a=function(e){return e.replace("/index.","").replace("/subs.","")}},27:(e,r)=>{"use strict";Object.defineProperty(r,"__esModule",{value:!0}),r.TransformationInstruction=void 0;var t=["rewriteValue","assignKeys","rewriteKey","replacePair","arrayItems"],n=function(){function e(r,n){var o=this;this.key=r,this.rewriteValue=!!n.hasOwnProperty("rewriteValue"),this.replacePair=!!n.hasOwnProperty("replacePair"),this.assignKeys=n.assignKeys?n.assignKeys:null,this.resultValue=n.rewriteValue?n.rewriteValue:n.replacePair,this.rewriteKey=n.rewriteKey?n.rewriteKey:null,this.arrayItemsName=n.arrayItems?n.arrayItems:null,this.additionalKeys=new Map,Object.keys(n).filter((function(e){return!t.includes(e)})).forEach((function(r){o.additionalKeys.set(r,new e(r,n[r]))}))}return e.prototype.transformKey=function(e){return this.rewriteKey?this.rewriteKey:e},e.prototype.shouldRewriteValue=function(){return this.rewriteValue},e.prototype.isArrayMapping=function(){return null!==this.arrayItemsName},e.prototype.isRemovePair=function(){return!this.replacePair&&!this.rewriteValue&&null===this.arrayItemsName&&null===this.assignKeys&&null===this.rewriteKey&&void 0===this.resultValue&&0===this.additionalKeys.size},e}();r.TransformationInstruction=n},102:(e,r,t)=>{"use strict";Object.defineProperty(r,"__esModule",{value:!0}),r.identity=r.prefixReferences=r.transform=r.indexObject=void 0;var n=t(980);r.indexObject=function(e,t,n,o,i,a){a&&Object.entries(a).forEach((function(a){var s=o.length>0?o+"."+a[0]:""+a[0];n&&i.set(e+s,a[1]),i.set(e+s+t,a[1]),"object"==typeof a[1]&&r.indexObject(e,t,n,s,i,a[1])}))},r.transform=function(e,t){if(!e)return t(e);if(Array.isArray(e)){var n=[];return e.forEach((function(e){"object"==typeof e?n.push(r.transform(e,t)):n.push(t(e))})),t(n)}if("object"==typeof e){var o={};return Object.entries(e).forEach((function(e){"object"==typeof e[1]?o[e[0]]=r.transform(e[1],t):o[e[0]]=t(e[1])})),t(o)}return t(e)},r.prefixReferences=function(e){return"string"!=typeof e?e:e.replace(n.FIND_REFS,(function(e){if(e.startsWith("%%"))return e;var r=e.charCodeAt(1);return r>47&&r<58?"%"+n.INDEX_NAMESPACE+"."+e.substr(1):"%"+n.SUBS_NAMESPACE+"."+e.substr(1)}))},r.identity=function(e){return e}}},r={};function t(n){if(r[n])return r[n].exports;var o=r[n]={exports:{}};return e[n].call(o.exports,o,o.exports,t),o.exports}var n={};return(()=>{"use strict";var e=n;Object.defineProperty(e,"__esModule",{value:!0}),e.mapper=void 0;var r=t(616);e.mapper=r.createObjectUnpacker()})(),n})()})); |
{ | ||
"name": "object-unpacker", | ||
"version": "0.0.16", | ||
"version": "0.0.17", | ||
"description": "A JSON to JSON mapper in TypeScript", | ||
@@ -5,0 +5,0 @@ "main": "dist/index.js", |
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
60391