Skip to content

Commit

Permalink
Expand no-simple-type-checking-assertions regex, see: phetsims/mean-s…
Browse files Browse the repository at this point in the history
  • Loading branch information
marlitas committed Oct 19, 2022
1 parent 164dcac commit e9cee01
Show file tree
Hide file tree
Showing 4 changed files with 1 addition and 21 deletions.
9 changes: 0 additions & 9 deletions js/CCKCUtils.ts
Original file line number Diff line number Diff line change
Expand Up @@ -108,15 +108,6 @@ const CCKCUtils = {
else {
return value;
}
},

validateNodeIndex( nodeIndex: string ): void {
if ( assert ) {
assert && assert( typeof nodeIndex === 'string' || typeof nodeIndex === 'number', 'nodeIndex must be string or number' );
if ( typeof nodeIndex === 'number' ) {
assert && assert( !isNaN( nodeIndex ), 'nodeIndex may not be NaN' );
}
}
}
};

Expand Down
2 changes: 1 addition & 1 deletion js/model/Circuit.ts
Original file line number Diff line number Diff line change
Expand Up @@ -555,7 +555,7 @@ export default class Circuit {
this.rotateSingleVertexByAngle( vertex, pivotVertex, -2 * searchAngle );
const distance2 = this.closestDistanceToOtherVertex( vertex );

assert && assert( typeof distance1 === 'number' && typeof distance2 === 'number' );
assert && assert( distance1 !== null && distance2 !== null );
if ( distance2! <= distance1! ) {

// go back to the best spot
Expand Down
7 changes: 0 additions & 7 deletions js/model/analysis/mna/MNACircuit.ts
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,6 @@ import QRDecomposition from '../../../../../dot/js/QRDecomposition.js';
import Matrix from '../../../../../dot/js/Matrix.js';
import Utils from '../../../../../dot/js/Utils.js';
import arrayRemove from '../../../../../phet-core/js/arrayRemove.js';
import CCKCUtils from '../../../CCKCUtils.js';
import circuitConstructionKitCommon from '../../../circuitConstructionKitCommon.js';
import MNASolution from './MNASolution.js';
import MNACircuitElement from './MNACircuitElement.js';
Expand Down Expand Up @@ -52,8 +51,6 @@ export default class MNACircuit {
this.nodeSet = {};
for ( let k = 0; k < this.elements.length; k++ ) {
const element = this.elements[ k ];
assert && CCKCUtils.validateNodeIndex( element.nodeId0 );
assert && CCKCUtils.validateNodeIndex( element.nodeId1 );
this.nodeSet[ element.nodeId0 ] = element.nodeId0;
this.nodeSet[ element.nodeId1 ] = element.nodeId1;
}
Expand Down Expand Up @@ -130,8 +127,6 @@ export default class MNACircuit {
* @param nodeTerms - to accumulate the result
*/
private getCurrentTerms( node: string, side: 'nodeId0' | 'nodeId1', sign: number, nodeTerms: Term[] ): Term[] {
assert && CCKCUtils.validateNodeIndex( node );

// Each battery introduces an unknown current through the battery
for ( let i = 0; i < this.batteries.length; i++ ) {
const battery = this.batteries[ i ];
Expand Down Expand Up @@ -201,7 +196,6 @@ export default class MNACircuit {
const element = this.elements[ i ];
if ( element.containsNodeId( nodeToVisit ) ) {
const oppositeNode = element.getOppositeNode( nodeToVisit );
assert && CCKCUtils.validateNodeIndex( oppositeNode );
if ( !visited.includes( oppositeNode ) ) {
toVisit.push( oppositeNode );
}
Expand Down Expand Up @@ -438,7 +432,6 @@ class UnknownVoltage {
public readonly node: string; // the index of the node

public constructor( node: string ) {
assert && CCKCUtils.validateNodeIndex( node );
this.node = node;
}

Expand Down
4 changes: 0 additions & 4 deletions js/model/analysis/mna/MNACircuitElement.ts
Original file line number Diff line number Diff line change
Expand Up @@ -7,17 +7,13 @@
* @author Sam Reid (PhET Interactive Simulations)
*/

import CCKCUtils from '../../../CCKCUtils.js';
import circuitConstructionKitCommon from '../../../circuitConstructionKitCommon.js';

export default class MNACircuitElement {
public readonly nodeId0: string; // index of the start node
public readonly nodeId1: string; // index of the end node

public constructor( nodeId0: string, nodeId1: string ) {
assert && CCKCUtils.validateNodeIndex( nodeId0 );
assert && CCKCUtils.validateNodeIndex( nodeId1 );

this.nodeId0 = nodeId0;
this.nodeId1 = nodeId1;
}
Expand Down

0 comments on commit e9cee01

Please sign in to comment.