Skip to content

Commit

Permalink
feat(values.join()): add join() wrapper function.
Browse files Browse the repository at this point in the history
  • Loading branch information
sciborrudnicki committed Sep 24, 2023
1 parent 9788cb3 commit 971af80
Show file tree
Hide file tree
Showing 2 changed files with 23 additions and 0 deletions.
1 change: 1 addition & 0 deletions values/_index.scss
Original file line number Diff line number Diff line change
@@ -1 +1,2 @@
@forward 'values.combine.function';
@forward 'values.join.function';
22 changes: 22 additions & 0 deletions values/_values.join.function.scss
Original file line number Diff line number Diff line change
@@ -0,0 +1,22 @@
// Functions.
@use 'values.combine.function';

// Status: DONE
// Wrapper `values.join()` function for `values.combine()` combines by `list.join()` method multiple `$values` into the list.
// The parameters of the list (bracketed, delimiter, method, null, separator) can be changed by providing map value eg. (method: join).
// @arbitrary `$values...` Arbitrary values to combine into the returned list.
// @returns The return value is the list combined by join method, with a separator, and/or delimiter.
@function join($values...) {
@return values.combine((method: join), $values...);
}

// Examples.
// The default append method + separator auto.
// @debug join('&', layout sidebar, primary dark, extra small); // "&" layout sidebar primary dark extra small
// @debug join(('&', dark), layout sidebar, primary dark, extra small); // "&" dark layout sidebar primary dark extra small
// @debug join('&' dark, layout sidebar, primary dark, extra small); // "&" dark layout sidebar primary dark extra small
// @debug join((separator: comma), '&', layout sidebar, primary dark, extra small); // "&", layout, sidebar, primary, dark, extra, small

// Provide separator
// @debug join(1, 2, (delimiter: '-', separator: space), 3, 4); // 1 "-" 2 "-" 3 "-" 4
// @debug join(1, 2, (separator: comma), (prefix: spectre, separator: '-', suffix: end), 4, 5);

0 comments on commit 971af80

Please sign in to comment.