Files
2026-07-13 12:48:55 +08:00

2 lines
1.1 KiB
JavaScript

var t=function(t){t.getPayloads().forEach((t=>{let{match:e,val:o}=t;console.log("\n────────"),e.debug("highlight"),console.log(" ",JSON.stringify(o)),console.log("\n")}))},e={mutate:function(e){e.model.one.db={},e.methods.one.debug=e.methods.one.debug||{},e.methods.one.debug.payload=t},api:function(t){t.prototype.getPayloads=function(){let t=[],e=this.world.model.one.db||{};return this.fullPointer.forEach((o=>{let l=o[0];if(e.hasOwnProperty(l)){let a=this.update([o]);e[l].forEach((e=>{let o=this.update([e.ptr]);a.has(o)&&(t=t.concat({match:o,val:e.val}))}))}})),t},t.prototype.addPayload=function(t){let e=this.world.model.one.db||{};return this.fullPointer.forEach((o=>{let l=o[0];if(e[l]=e[l]||[],"function"==typeof t){let a=this.update([o]),n=t(a);null!=n&&e[l].push({ptr:o,val:n})}else e[l].push({ptr:o,val:t})})),this},t.prototype.clearPayloads=function(){let t=this.world.model.one.db||{};return this.getPayloads().forEach((e=>{let o=e.match.fullPointer[0]||[],[l,a,n]=o;t[l]=t[l]||[],t[l]=t[l].filter((t=>t.ptr[1]!==a||t.ptr[2]!==n)),0===t[l].length&&delete t[l]})),this}}};export{e as default};