From ac1f3da1da7759d8537b60a7f6b5ceb1a30a361e Mon Sep 17 00:00:00 2001 From: Volpeon Date: Sat, 12 Feb 2022 17:32:32 +0100 Subject: Add list-reverse function --- src/_functions.scss | 19 +++++++++++++++++++ 1 file changed, 19 insertions(+) (limited to 'src') diff --git a/src/_functions.scss b/src/_functions.scss index 236b548..9dd14b1 100644 --- a/src/_functions.scss +++ b/src/_functions.scss @@ -97,6 +97,25 @@ @return $result; } +/// +/// Reverse the order of items in a list. +/// +/// @param {list} $list +/// +/// @return {list} Teh reversed list +/// +@function list-reverse($list) { + @if length($list) == 0 { + @return $list; + } + + $result: (); + @for $i from length($list) * -1 through -1 { + $result: append($result, nth($list, abs($i))); + } + @return $result; +} + /// /// Sort numeric items in a list. /// -- cgit v1.2.3-70-g09d2