Pages
Introduction
Getting Started
Recipes
Reference
Literals
Arrays
Tuples
Type System
Functions
Modules
Records
Enums
Built-in Types
Constants
Equality
Stores
Routing
Comments
Control Expressions
Components
Properties
Computed Properties
Styling Elements
Connecting Stores
Using Providers
Internal State
Referencing Entities
Global Components
Lifecycle Functions
Directives
JavaScript Interop
Environment Variables
Packages
Equality
In Mint, two 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
-
Bool
-
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
===