mapSet (Function)

Signature: mapSet(map: Map<string, t0>, key: string, value: t0) -> Map<string, t0>

Description: Returns a new map with key bound to value (replaces prior binding).

Parameters

  • map (Map<string, t0>): The map
  • key (string): Key
  • value (t0): Value

Returns: Map<string, t0>

Example

mapSet({"a": 1}, "b", 2)  // {"a": 1, "b": 2}
mapSet (["a" => 1], "b", 2)  // {"a": 1, "b": 2}