isSubmap method

bool isSubmap(
  1. Eq<K> eqK,
  2. Eq<V> eqV,
  3. Map<K, V> map
)

Test whether or not the given map contains all of the keys and values contained in this Map.

Implementation

bool isSubmap(
  Eq<K> eqK,
  Eq<V> eqV,
  Map<K, V> map,
) =>
    foldLeftWithKey<bool>(
      Order.allEqual(),
      true,
      (b, k, v) =>
          b &&
          map.entries.any(
            (e) => eqK.eqv(e.key, k) && eqV.eqv(e.value, v),
          ),
    );