UNPKG

acebase-core

Version:

Shared AceBase core components, no need to install manually

18 lines 616 B
/** * Sparse/partial array converted to a serializable object. Use `Object.keys(sparseArray)` and `Object.values(sparseArray)` to iterate its indice and/or values */ export class PartialArray { constructor(sparseArray) { if (sparseArray instanceof Array) { for (let i = 0; i < sparseArray.length; i++) { if (typeof sparseArray[i] !== 'undefined') { this[i] = sparseArray[i]; } } } else if (sparseArray) { Object.assign(this, sparseArray); } } } //# sourceMappingURL=partial-array.js.map