Closed pixelzoom closed 5 years ago
Using validation options will also make assertions like this in CurveFittingModel unnecessary:
// validate Property values and update curve fit
this.orderProperty.link( order => {
// ensure the order is 1, 2 or 3: linear, quadratic or cubic
assert && assert( order === 1 || order === 2 || order === 3, `invalid order: ${order}` );
...
I have now added more property validation. Assigning to @pixelzoom to review.
Looks good, closing.
Related to this item in code review #143:
There are currently no usages of validation options in this sim. This info is important for catching programming errors, and for future PhET-iO instrumentation.
For example, in Curve.js:
should be:
In Point.js:
should be:
So....
range
for any that have a range.valueType
orisValidValue
where possible.