Skip to content

Collection #142

Description

@dwhieb
/** * A class representing a collection. Each item in the collction will be an instance of the provided Model. * @extends Array */classCollectionextendsArray{/** * Create a new Collection * @param {Function} Model The class to use as the model for each item in the collection */constructor(Model){super();returnnewProxy(this,{set(target,prop,val,proxy){if(Number.isInteger(Number(prop))){val=newModel(val);// eslint-disable-line no-param-reassign}returnReflect.set(target,prop,val,proxy);},});}}exportdefaultCollection;

Metadata

Metadata

Assignees

Labels

coreCore models and utilitiesfeatureChanges that affect the API

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions