UNPKG

@animech-public/playcanvas

Version:
2 lines (1 loc) 709 B
import{CompressUtils as t}from"./compress-utils.js";class s{constructor(t,s){this._node=t,this._data=s}run(){const t=Object.prototype.toString.call(this._node);return"[object Object]"===t?this._handleMap():"[object Array]"===t?this._handleArray():this._result=this._node,this._result}_handleMap(){this._result={};Object.keys(this._node).forEach(this._handleKey,this)}_handleKey(e){let h=e;const r=e.length;1===r?h=t.oneCharToKey(e,this._data):2===r&&(h=t.multCharToKey(e,this._data)),this._result[h]=new s(this._node[e],this._data).run()}_handleArray(){this._result=[],this._node.forEach(this._handleArElt,this)}_handleArElt(t){const e=new s(t,this._data).run();this._result.push(e)}}export{s as Decompress};