Property interface: How should `equals` be implemented?

I’m implementing a custom Property in my project, and need some clarification with the equals method. What kind of equality is expected: deep equality, reference equality, or something else? How does this method get used internally?

Hi @emc2hi ,
Thanks for your question.

Looking through ...Property classes most implement checks of individual attributes, for example cesium/packages/engine/Source/DataSources/GridMaterialProperty.js at 8ca35977c25a028a71cbb4770853b1784076e7e5 · CesiumGS/cesium · GitHub

However the baseline is to use === as you can see here in the source code for Property.js cesium/packages/engine/Source/DataSources/Property.js at 8ca35977c25a028a71cbb4770853b1784076e7e5 · CesiumGS/cesium · GitHub so it is possible we are not being entirely consistent across all the classes. If you see any that are not consistent please let us know or open an issue.

I think for implementing a new class it makes sense to follow the later convention of checking attributes.

Best,
Luke

1 Like