Closed chrisklus closed 4 years ago
Committed above, @pixelzoom please review.
Why do you iterate over all warnings? This should return as soon as key
is found. I.e.:
hasWarning: function( key ) {
let hasWarning = false;
for ( let i = 0; i < this.warnings.length && !hasWarning; i++ ) {
hasWarning = ( this.warnings[ i ].key === key );
}
return hasWarning;
}
Thanks, fixed above. Working on my end, feel free to close if it looks good.
👍 Testing in Natural Selection. Closing.
From https://github.com/phetsims/query-string-machine/issues/39#issuecomment-601901542.
In https://github.com/phetsims/joist/issues/593, @pixelzoom and I used lodash for the
hasWarning
function, as @pixelzoom needed the function in NaturalSelectionQueryParameters.js. I'll implement a manual version instead.