Skip to content

Commit

Permalink
use AssertUtils.assertPositiveNumber
Browse files Browse the repository at this point in the history
  • Loading branch information
pixelzoom committed Jun 15, 2021
1 parent de930c9 commit 13063c3
Show file tree
Hide file tree
Showing 3 changed files with 7 additions and 4 deletions.
5 changes: 3 additions & 2 deletions js/common/model/XAxisDescription.js
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,7 @@
*/

import Range from '../../../../dot/js/Range.js';
import AssertUtils from '../../../../phetcommon/js/AssertUtils.js';
import fourierMakingWaves from '../../fourierMakingWaves.js';
import AxisDescription from './AxisDescription.js';
import Domain from './Domain.js';
Expand All @@ -34,8 +35,8 @@ class XAxisDescription extends AxisDescription {
createAxisRange( domain, L, T ) {

assert && assert( Domain.includes( domain ) );
assert && assert( typeof L === 'number' && L > 0 );
assert && assert( typeof T === 'number' && T > 0 );
assert && AssertUtils.assertPositiveNumber( L );
assert && AssertUtils.assertPositiveNumber( T );

const value = ( domain === Domain.TIME ) ? T : L;
const xMin = value * this.range.min;
Expand Down
2 changes: 1 addition & 1 deletion js/discrete/view/PeriodClockNode.js
Original file line number Diff line number Diff line change
Expand Up @@ -194,7 +194,7 @@ function createElapsedTimeShape( harmonic, t, radius ) {

assert && assert( harmonic instanceof Harmonic );
assert && AssertUtils.assertNonNegativeNumber( t );
assert && assert( typeof radius === 'number' && radius > 0 );
assert && AssertUtils.assertPositiveNumber( radius );

const percentTime = ( t % harmonic.period ) / harmonic.period;
const startAngle = -Math.PI / 2; // 12:00
Expand Down
4 changes: 3 additions & 1 deletion js/waveGame/view/WaveGameAmplitudesChartNode.js
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,7 @@

import NumberProperty from '../../../../axon/js/NumberProperty.js';
import dotRandom from '../../../../dot/js/dotRandom.js';
import AssertUtils from '../../../../phetcommon/js/AssertUtils.js';
import PressListener from '../../../../scenery/js/listeners/PressListener.js';
import AmplitudesChartNode from '../../common/view/AmplitudesChartNode.js';
import fourierMakingWaves from '../../fourierMakingWaves.js';
Expand Down Expand Up @@ -90,7 +91,8 @@ class WaveGameAmplitudesChartNode extends AmplitudesChartNode {
* @public
*/
setAmplitudeVisible( order, visible ) {
assert && assert( typeof order === 'number' && order > 0 && order <= this.sliders.length, `invalid order: ${order}` );
assert && AssertUtils.assertPositiveNumber( order );
assert && assert( order <= this.sliders.length, `invalid order: ${order}` );
assert && assert( typeof visible === 'boolean' );

const index = order - 1;
Expand Down

0 comments on commit 13063c3

Please sign in to comment.