-
Notifications
You must be signed in to change notification settings - Fork 0
Closed
Labels
coreCore models and utilitiesCore models and utilitiesfeatureChanges that affect the APIChanges that affect the API
Description
/**
* A class representing a collection. Each item in the collction will be an instance of the provided Model.
* @extends Array
*/
class Collection extends Array {
/**
* Create a new Collection
* @param {Function} Model The class to use as the model for each item in the collection
*/
constructor(Model) {
super();
return new Proxy(this, {
set(target, prop, val, proxy) {
if (Number.isInteger(Number(prop))) {
val = new Model(val); // eslint-disable-line no-param-reassign
}
return Reflect.set(target, prop, val, proxy);
},
});
}
}
export default Collection;Metadata
Metadata
Assignees
Labels
coreCore models and utilitiesCore models and utilitiesfeatureChanges that affect the APIChanges that affect the API