Skip to content

assertHasProperties

Overview

Throws an assertion error if specified object doesn't have all provided properties. This will also work for anything defined on class prototypes (like Node.prototype.setOpacity)

@example assertHasProperties( { tree:1, flower:2 }, [ 'tree' ] ) => no error assertHasProperties( { flower:2 }, [ 'tree' ] ) => error assertHasProperties( { tree:1, flower:2 }, [ 'tree', 'flower' ] ) => no error assertHasProperties( { tree:1 }, [ 'tree', 'flower' ] ) => error assertHasProperties( new phet.scenery.Node(), [ 'getOpacity','opacity', '_opacity' ] ) => no error

@author Michael Kauzmann (PhET Interactive Simulations)

Source Code

See the source for assertHasProperties.ts in the phet-core repository.