// Sass.
@use 'sass:list';
@use 'sass:string';
// The `string.join()` function.
@function join($delimiter, $elements...) {
$string: '';
@each $element in $elements {
@if list.index(color list number string, type-of($element)) {
@each $element in $element {
$string: string.insert($string, #{$element}#{$delimiter or ''}, -1);
}
}
}
@return string.slice($string, 1, calc((string.length($delimiter) + 1) * -1));
}
// Use.
@use '@angular-package/sass/string';
// Examples.
@debug string.join('-');
@debug string.join('-', 'a', 'b', 'c'); // a-b-c
@debug string.join('-', '', 'a', 'b', 'c'); // -a-b-c
@debug string.join('-', 'a', 'b', 'c', ''); // a-b-c-
@debug string.join('-', '', 'a', 'b', 'c', ''); // a-b-c-
@debug string.join('-', 'a', ('b', 'c')); // a-b-c
@debug string.join('-', a, b, c); // a-b-c
// Join number.
@debug string.join('-', a, 1, b, 2, c, 3); // a-1-b-2-c-3
// Join color.
@debug string.join('-', silver, orange, green, red, blue, yellow); // silver-orange-green-red-blue-yellow