modifyAt method

Option<Map<K, V>> Function(K key, V (V value)) modifyAt(
  1. Eq<K> eq
)

If the given key is present in the Map, then modify its value using modify and return a the new Map. Otherwise, return None.

Implementation

Option<Map<K, V>> Function(K key, V Function(V value)) modifyAt(Eq<K> eq) =>
    (K key, V Function(V value) modify) => member(key)
        ? some(
            map(
              (k, v) =>
                  eq.eqv(k, key) ? MapEntry(key, modify(v)) : MapEntry(k, v),
            ),
          )
        : none();