Augmentations for maps.

Remarks

Importing this module

This module's augmentations can be applied by using the following import:

import "@neotype/extensions/map.js";

Comparing maps

Maps have the following behavior as an equivalence relation:

  • A Map<K, V> or a ReadonlyMap<K, V> implements Eq when V implements Eq.
  • Two maps are equal if:
    1. they are the same size;
    2. they contain the same keys (compared strictly); and
    3. for each key, the corresponding values are equal.
  • Read-only and non-read-only maps can be compared to each other.

Combining maps as a semigroup

Maps implement Semigroup.

  • Maps are combined by taking their union.
  • If a key is mapped to two different values, only the right-hand map's value is retained.
  • Read-only and non-read-only maps can be combined with each other.
  • If either map is read-only, the resulting map will also be read-only.

Index

Interfaces

Generated using TypeDoc