const SUBARRAY_SIZE = 0x10000; const BigArrayHandler = { get: function(obj, prop) { if (!isNaN(prop)) { return obj.getElement(prop); } else return obj[prop]; }, set: function(obj, prop, value) { if (!isNaN(prop)) { return obj.setElement(prop, value); } else { obj[prop] = value; return true; } } }; class _BigArray { constructor (initSize) { this.length = initSize || 0; this.arr = []; for (let i=0; i= this.length) this.length = idx+1; return true; } } class BigArray { constructor( initSize ) { const obj = new _BigArray(initSize); const extObj = new Proxy(obj, BigArrayHandler); return extObj; } } module.exports = BigArray;