Try Install Learn Blog API Packages GitHub
Pages

Equality

In Mint, 2 objects are considered equal if they have the same type and all its values are equal.

The equality operator is: ==

{ name = "Jon Doe", age = 27 } == { age = 27, name = "Jon Doe" } /* true */
Maybe::Just("A") == Maybe::Just("A") /* true */
["A"] == ["A"] /* true */

In JavaScript, the same == comparison would return false. We say Mint uses "logical" equality.

In addition to records and enums , the following types use logical equality:

  • String
  • Number
  • Boolean
  • Date
  • Map
  • Set
  • Maybe
  • Result
  • Array
  • FormData
  • SearchParams

Types that does not implement the logical equality operation fall back to using the JavaScript strict equality operator ===