@use 'str-replace' as *;

/// Replaces a substring within each string in a list.
/// @param {list} $strings List of strings.
/// @param {string} $search Substring.
/// @param {string} $replace Replacement.
/// @return {list} Updated list of strings.
@function str-replace-all($strings, $search, $replace: '') {

  @each $string in $strings {
    $strings: set-nth($strings, index($strings, $string), str-replace($string, $search, $replace));
  }

  @return $strings;

}
