map.deep-merge()

The modified map.deep-merge() function merges multiple maps by using sass original deep-merge().

The function modify original map.deep-merge() by adding arbitrary $maps... argument, to deep merge multiple maps.

// Sass.
@use 'sass:map';

// The `map.deep-merge()` function.
@function deep-merge($map1, $map2, $maps...) {
  $map1: map.deep-merge($map1, $map2);
  @each $map in $maps {
    $map1: map.deep-merge($map1, $map);
  }
  @return $map1;
}

Parameters

$map1

A map to deep merge with $map2.

$map2

A map to deep merge with $map1.

$maps...

Multiple maps to deep merge with the merged $map1 and $map2.

Return

The return value is the map built from $map1, $map2 and $maps.

Examples

// Use.
@use '@angular-package/sass/map';

// Examples.
@debug map.deep-merge((prefix: spectre), (suffix: end), (affix: name)); // (prefix: spectre, suffix: end, affix: name)

Last updated