Skip to content

Commit

Permalink
replaced InvertedBooleanProperty with DerivedProperty.not, see phetsi…
Browse files Browse the repository at this point in the history
  • Loading branch information
jbphet committed Jun 8, 2020
1 parent 8ef959b commit d6782d4
Showing 1 changed file with 12 additions and 0 deletions.
12 changes: 12 additions & 0 deletions js/DerivedProperty.js
Original file line number Diff line number Diff line change
Expand Up @@ -202,6 +202,18 @@ class DerivedProperty extends Property {
static or( properties, options ) {
return new DerivedProperty( properties, _.reduce.bind( null, properties, orFunction, false ), options );
}

/**
* Creates a derived boolean Property whose value is the inverse of the provided property.
* @public
*
* @param {<Property.<boolean>>} propertyToInvert
* @param {Object} [options] - Forwarded to the DerivedProperty
* @returns {DerivedProperty.<boolean>}
*/
static not( propertyToInvert, options ) {
return new DerivedProperty( [ propertyToInvert ], x => !x, options );
}
}

const equalsFunction = ( a, b ) => {
Expand Down

0 comments on commit d6782d4

Please sign in to comment.