aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorVolpeon <git@volpeon.ink>2022-02-12 17:32:32 +0100
committerVolpeon <git@volpeon.ink>2022-02-12 17:32:32 +0100
commitac1f3da1da7759d8537b60a7f6b5ceb1a30a361e (patch)
treef13eef0688067590f7b6404ac19d8d8dcebf5ce2
parentReplace deep map functions with built-ins (diff)
downloadiro-sass-ac1f3da1da7759d8537b60a7f6b5ceb1a30a361e.tar.gz
iro-sass-ac1f3da1da7759d8537b60a7f6b5ceb1a30a361e.tar.bz2
iro-sass-ac1f3da1da7759d8537b60a7f6b5ceb1a30a361e.zip
Add list-reverse function
-rw-r--r--src/_functions.scss19
1 files changed, 19 insertions, 0 deletions
diff --git a/src/_functions.scss b/src/_functions.scss
index 236b548..9dd14b1 100644
--- a/src/_functions.scss
+++ b/src/_functions.scss
@@ -98,6 +98,25 @@
98} 98}
99 99
100/// 100///
101/// Reverse the order of items in a list.
102///
103/// @param {list} $list
104///
105/// @return {list} Teh reversed list
106///
107@function list-reverse($list) {
108 @if length($list) == 0 {
109 @return $list;
110 }
111
112 $result: ();
113 @for $i from length($list) * -1 through -1 {
114 $result: append($result, nth($list, abs($i)));
115 }
116 @return $result;
117}
118
119///
101/// Sort numeric items in a list. 120/// Sort numeric items in a list.
102/// 121///
103/// The implementation is based on the algorithm on the German Wikipedia article 122/// The implementation is based on the algorithm on the German Wikipedia article