Skip to content

Model.defineModelProp() - #147

Merged
dwhieb merged 7 commits into
masterfrom
issue-143
Aug 18, 2020
Merged

Model.defineModelProp()#147
dwhieb merged 7 commits into
masterfrom
issue-143

Conversation

@dwhieb

Copy link
Copy Markdown
Member

Related Issue

closes#143

Description

Many properties of DLx objects are required to be of a certain type (MultiLangString, Transcription, etc.). This utility function provides an abstraction for defining those properties in a way that ensures their values are validated against the proper Model when the value is set. Example usage:

classTextextendsModel{
#title;// private property must be declaredconstructor(){// ensures that the "title" property is always a MultiLangStringModel.defineModelProp(this,`title`,MultiLangString);}}

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:17
@dwhiebdwhieb self-assigned this Aug 16, 2020
@dwhiebdwhieb added the core Core models and utilities label Aug 16, 2020
@dwhieb

Copy link
Copy Markdown
MemberAuthor

@dwhiebdwhieb added the feature Changes that affect the API label Aug 16, 2020
Comment threadsrc/core/Model.js
@dwhieb
dwhieb merged commit 90cb674 into masterAug 18, 2020
@dwhieb
dwhieb deleted the issue-143 branch August 18, 2020 18:53
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.defineModelProp

2 participants

@dwhieb@vadekh