Skip to content

Model.defineArrayProp() - #148

Merged
dwhieb merged 8 commits into
masterfrom
issue-144
Aug 18, 2020
Merged

Model.defineArrayProp()#148
dwhieb merged 8 commits into
masterfrom
issue-144

Conversation

@dwhieb

Copy link
Copy Markdown
Member

Related Issue

closes#144

Description

This PR adds the Model.defineArrayProp() utility method, which defines an array property on an object where each item in the array is expected to be an instance of a particular class/model. When the user sets this property to a new array, each item in the array is transformed into an instance of the provided class/model.

This method does not prevent users from adding items to the array which are not instances of the model. (Issue #142 creates a Collection class which is used for this purpose.)

Checklist

  • Check out the Contributing Guidelines if you need help getting started with your pull request.

  • Open an issue for the change (if one doesn't already exist).

  • Update tests for planned changes. Check that they are failing. (npm test)

  • Write code to pass the tests. (npm test)

  • Add inline code commenting (using JSDoc style). Add links to cross-referenced modules, and the DLx data format.

  • Generate the developer documentation (npm run docs) and check your changes by opening docs/index.html in a browser.

@dwhieb
dwhieb requested a review from vadekhAugust 16, 2020 23:48
@dwhiebdwhieb self-assigned this Aug 16, 2020
@dwhiebdwhieb added core Core models and utilities feature Changes that affect the API labels Aug 16, 2020
@dwhieb
dwhieb marked this pull request as ready for review August 16, 2020 23:49
@dwhieb

Copy link
Copy Markdown
MemberAuthor

@dwhieb
dwhieb merged commit 1b75232 into masterAug 18, 2020
@dwhieb
dwhieb deleted the issue-144 branch August 18, 2020 19:01
Sign up for freeto join this conversation on GitHub. Already have an account? Sign in to comment

Labels

coreCore models and utilitiesfeatureChanges that affect the API

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Model.defineArrayProp

2 participants

@dwhieb@vadekh