Skip to content

Commit

Permalink
convert to es6, phetsims/tasks#1051
Browse files Browse the repository at this point in the history
  • Loading branch information
zepumph committed Nov 12, 2020
1 parent 336e759 commit e56d381
Show file tree
Hide file tree
Showing 5 changed files with 9 additions and 18 deletions.
8 changes: 4 additions & 4 deletions js/common/model/Units.js
Original file line number Diff line number Diff line change
Expand Up @@ -43,7 +43,7 @@ const Units = {
* @param {boolean} abbreviated value. Abbreviate to 1 decimal place for metric and 2 decimal places for others.
* @returns {string}
*/
getPressureString: function( pressure, measureUnits, abbreviated ) {
getPressureString( pressure, measureUnits, abbreviated ) {
if ( measureUnits === 'metric' ) {
return StringUtils.format( valueWithUnitsPatternString, Utils.toFixed( pressure / 1000, abbreviated ? 1 : 3 ), kPaString );
}
Expand All @@ -63,7 +63,7 @@ const Units = {
* @param {string} measureUnits (english/metric/atmosphere)
* @returns {string}
*/
getGravityString: function( gravity, measureUnits ) {
getGravityString( gravity, measureUnits ) {

if ( measureUnits === 'english' ) {
return StringUtils.format( valueWithUnitsPatternString, Utils.toFixed( GRAVITY_ENGLISH_PER_METRIC * gravity, 1 ),
Expand All @@ -80,7 +80,7 @@ const Units = {
* @param {string} measureUnits (english/metric/atmosphere)
* @returns {string}
*/
getFluidDensityString: function( fluidDensity, measureUnits ) {
getFluidDensityString( fluidDensity, measureUnits ) {
let value;
let units;
if ( measureUnits === 'english' ) {
Expand All @@ -96,7 +96,7 @@ const Units = {
},

// converts feet to meters
feetToMeters: function( feet ) {
feetToMeters( feet ) {
return feet / FEET_PER_METER;
}
};
Expand Down
4 changes: 1 addition & 3 deletions js/common/model/VelocitySensor.js
Original file line number Diff line number Diff line change
Expand Up @@ -21,9 +21,7 @@ class VelocitySensor extends Sensor {
super( position, value );

// @public
this.isArrowVisibleProperty = new DerivedProperty( [ this.valueProperty ], function( value ) {
return value.magnitude > 0;
} );
this.isArrowVisibleProperty = new DerivedProperty( [ this.valueProperty ], value => value.magnitude > 0 );
}
}

Expand Down
5 changes: 1 addition & 4 deletions js/common/model/getStandardAirPressure.js
Original file line number Diff line number Diff line change
Expand Up @@ -16,11 +16,8 @@ import Constants from '../Constants.js';
* @param {number} height (in meters) at which the air pressure needs to be calculated
* @returns {number} standard air pressure at the specified height from ground
*/
const getStandardAirPressure = function( height ) {
//Note: 150 meters is 500 feet
return Utils.linear( 0, 150, Constants.EARTH_AIR_PRESSURE,
const getStandardAirPressure = height => Utils.linear( 0, 150, Constants.EARTH_AIR_PRESSURE,
Constants.EARTH_AIR_PRESSURE_AT_500_FT, height );
};

fluidPressureAndFlow.register( 'getStandardAirPressure', getStandardAirPressure );

Expand Down
2 changes: 1 addition & 1 deletion js/under-pressure/view/MassStackNode.js
Original file line number Diff line number Diff line change
Expand Up @@ -80,7 +80,7 @@ class MassStackNode extends Node {
updateMassPositions() {
let dy = 0;
const chamberPoolModel = this.chamberPoolModel;
chamberPoolModel.stack.forEach( function( massModel ) {
chamberPoolModel.stack.forEach( massModel => {
massModel.positionProperty.value = new Vector2( chamberPoolModel.poolDimensions.leftOpening.x1 + massModel.width / 2,
chamberPoolModel.poolDimensions.leftOpening.y2 + chamberPoolModel.leftWaterHeight -
chamberPoolModel.leftDisplacementProperty.value + dy + massModel.height / 2 );
Expand Down
8 changes: 2 additions & 6 deletions js/watertower/view/WaterTowerLegsNode.js
Original file line number Diff line number Diff line change
Expand Up @@ -66,13 +66,9 @@ class WaterTowerLegsNode extends Node {
const options = this.options;

// use 1 instead of 0 when the height is 0. This is to prevent divide by zero and other problems.
const fLeftLegX = function( y ) {
return Utils.linear( 0, height > 0 ? height : 1, leftLegTopX, 0, y ); //y1, y2, x1, x2
};
const fLeftLegX = y => Utils.linear( 0, height > 0 ? height : 1, leftLegTopX, 0, y );

const fRightLegX = function( y ) {
return Utils.linear( 0, height > 0 ? height : 1, rightLegTopX, width, y );
};
const fRightLegX = y => Utils.linear( 0, height > 0 ? height : 1, rightLegTopX, width, y );

//Left leg
this.leftLegPath.setShape( new Shape().moveTo( fLeftLegX( 0 ), 0 )
Expand Down

0 comments on commit e56d381

Please sign in to comment.