2 lines
1.3 KiB
JavaScript
2 lines
1.3 KiB
JavaScript
var e,t;e=this,t=function(){var e=function(e){e.getPayloads().forEach((e=>{let{match:t,val:o}=e;console.log("\n────────"),t.debug("highlight"),console.log(" ",JSON.stringify(o)),console.log("\n")}))};return{mutate:function(t){t.model.one.db={},t.methods.one.debug=t.methods.one.debug||{},t.methods.one.debug.payload=e},api:function(e){e.prototype.getPayloads=function(){let e=[],t=this.world.model.one.db||{};return this.fullPointer.forEach((o=>{let l=o[0];if(t.hasOwnProperty(l)){let n=this.update([o]);t[l].forEach((t=>{let o=this.update([t.ptr]);n.has(o)&&(e=e.concat({match:o,val:t.val}))}))}})),e},e.prototype.addPayload=function(e){let t=this.world.model.one.db||{};return this.fullPointer.forEach((o=>{let l=o[0];if(t[l]=t[l]||[],"function"==typeof e){let n=this.update([o]),a=e(n);null!=a&&t[l].push({ptr:o,val:a})}else t[l].push({ptr:o,val:e})})),this},e.prototype.clearPayloads=function(){let e=this.world.model.one.db||{};return this.getPayloads().forEach((t=>{let o=t.match.fullPointer[0]||[],[l,n,a]=o;e[l]=e[l]||[],e[l]=e[l].filter((e=>e.ptr[1]!==n||e.ptr[2]!==a)),0===e[l].length&&delete e[l]})),this}}}},"object"==typeof exports&&"undefined"!=typeof module?module.exports=t():"function"==typeof define&&define.amd?define(t):(e="undefined"!=typeof globalThis?globalThis:e||self).compromisePayload=t();
|