SassyLists 1.1.0 → 1.1.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- checksums.yaml +4 -4
- data/CHANGELOG.md +36 -36
- data/lib/SassyLists.rb +13 -13
- data/stylesheets/SassyLists/_chunk.scss +41 -41
- data/stylesheets/SassyLists/_contain.scss +17 -17
- data/stylesheets/SassyLists/_count-values.scss +18 -18
- data/stylesheets/SassyLists/_debug.scss +96 -96
- data/stylesheets/SassyLists/_explode.scss +49 -49
- data/stylesheets/SassyLists/_first.scss +23 -23
- data/stylesheets/SassyLists/_flatten.scss +35 -35
- data/stylesheets/SassyLists/_insert-nth.scss +46 -46
- data/stylesheets/SassyLists/_intersection.scss +28 -28
- data/stylesheets/SassyLists/_is-symmetrical.scss +18 -18
- data/stylesheets/SassyLists/_last-index.scss +20 -20
- data/stylesheets/SassyLists/_last.scss +17 -17
- data/stylesheets/SassyLists/_loop.scss +35 -35
- data/stylesheets/SassyLists/_prepend.scss +20 -20
- data/stylesheets/SassyLists/_purge.scss +27 -27
- data/stylesheets/SassyLists/_random-value.scss +29 -29
- data/stylesheets/SassyLists/_remove-duplicates.scss +24 -24
- data/stylesheets/SassyLists/_remove-nth.scss +19 -19
- data/stylesheets/SassyLists/_remove.scss +20 -20
- data/stylesheets/SassyLists/_replace-nth.scss +24 -24
- data/stylesheets/SassyLists/_replace.scss +29 -29
- data/stylesheets/SassyLists/_reverse.scss +29 -29
- data/stylesheets/SassyLists/_shuffle.scss +29 -29
- data/stylesheets/SassyLists/_slice.scss +48 -48
- data/stylesheets/SassyLists/_sort.scss +40 -40
- data/stylesheets/SassyLists/_sum.scss +28 -28
- data/stylesheets/SassyLists/_tail.scss +18 -18
- data/stylesheets/SassyLists/_to-string.scss +25 -25
- data/stylesheets/SassyLists/_union.scss +21 -21
- data/stylesheets/SassyLists/_walk.scss +23 -23
- data/stylesheets/SassyLists/helpers/_str-compare.scss +24 -24
- data/stylesheets/SassyLists/helpers/_true.scss +10 -10
- data/stylesheets/_SassyLists.scss +38 -38
- metadata +3 -3
@@ -1,36 +1,36 @@
|
|
1
|
-
// Turns multidimensional $list into a one-level list
|
2
|
-
//
|
3
|
-
// @ignore Documentation: http://sassylists.com/documentation.html#flatten
|
4
|
-
//
|
5
|
-
// @param {List} $list - list to flatten
|
6
|
-
//
|
7
|
-
// @return {List}
|
8
|
-
|
9
|
-
@function flatten($list) {
|
10
|
-
$result: ();
|
11
|
-
|
12
|
-
@if length($list) == 1 {
|
13
|
-
@return $list;
|
14
|
-
}
|
15
|
-
|
16
|
-
@each $item in $list {
|
17
|
-
@if length($item) > 1 {
|
18
|
-
$flatten: flatten($item);
|
19
|
-
@each $i in $flatten {
|
20
|
-
$result: append($result, $i, list-separator($list));
|
21
|
-
}
|
22
|
-
}
|
23
|
-
|
24
|
-
@else {
|
25
|
-
$result: append($result, $item, list-separator($list));
|
26
|
-
}
|
27
|
-
}
|
28
|
-
|
29
|
-
@return $result;
|
30
|
-
}
|
31
|
-
|
32
|
-
// @alias flatten
|
33
|
-
|
34
|
-
@function unfold($list) {
|
35
|
-
@return flatten($list);
|
1
|
+
// Turns multidimensional $list into a one-level list
|
2
|
+
//
|
3
|
+
// @ignore Documentation: http://sassylists.com/documentation.html#flatten
|
4
|
+
//
|
5
|
+
// @param {List} $list - list to flatten
|
6
|
+
//
|
7
|
+
// @return {List}
|
8
|
+
|
9
|
+
@function flatten($list) {
|
10
|
+
$result: ();
|
11
|
+
|
12
|
+
@if length($list) == 1 {
|
13
|
+
@return $list;
|
14
|
+
}
|
15
|
+
|
16
|
+
@each $item in $list {
|
17
|
+
@if length($item) > 1 {
|
18
|
+
$flatten: flatten($item);
|
19
|
+
@each $i in $flatten {
|
20
|
+
$result: append($result, $i, list-separator($list));
|
21
|
+
}
|
22
|
+
}
|
23
|
+
|
24
|
+
@else {
|
25
|
+
$result: append($result, $item, list-separator($list));
|
26
|
+
}
|
27
|
+
}
|
28
|
+
|
29
|
+
@return $result;
|
30
|
+
}
|
31
|
+
|
32
|
+
// @alias flatten
|
33
|
+
|
34
|
+
@function unfold($list) {
|
35
|
+
@return flatten($list);
|
36
36
|
}
|
@@ -1,46 +1,46 @@
|
|
1
|
-
// Adds $value at $index in $list
|
2
|
-
//
|
3
|
-
// @ignore Documentation: http://sassylists.com/documentation/#insert-nth
|
4
|
-
//
|
5
|
-
// @requires is-true
|
6
|
-
//
|
7
|
-
// @param {List} $list - list to update
|
8
|
-
// @param {Number} $index - index to add
|
9
|
-
// @param {*} $value - value to add
|
10
|
-
//
|
11
|
-
// @throws List index $index is not a number for `insert-nth`.
|
12
|
-
// @throws List index $index must be a non-zero integer for `insert-nth`.
|
13
|
-
//
|
14
|
-
// @return {List | Bool}
|
15
|
-
|
16
|
-
@function insert-nth($list, $index, $value) {
|
17
|
-
$length: length($list);
|
18
|
-
|
19
|
-
@if type-of($index) != number {
|
20
|
-
@warn "List index #{$index} is not a number for `insert-nth`.";
|
21
|
-
@return false;
|
22
|
-
}
|
23
|
-
|
24
|
-
@if $index < 1 {
|
25
|
-
@warn "List index #{$index} must be a non-zero integer for `insert-nth`.";
|
26
|
-
@return false;
|
27
|
-
}
|
28
|
-
|
29
|
-
@if $index > $length {
|
30
|
-
@return append($list, $value, list-separator($list));
|
31
|
-
}
|
32
|
-
|
33
|
-
$result: ();
|
34
|
-
|
35
|
-
@for $i from 1 through $length {
|
36
|
-
@if $i == $index {
|
37
|
-
@if is-true($value) {
|
38
|
-
$result: append($result, $value, list-separator($list));
|
39
|
-
}
|
40
|
-
}
|
41
|
-
|
42
|
-
$result: append($result, nth($list, $i), list-separator($list));
|
43
|
-
}
|
44
|
-
|
45
|
-
@return $result;
|
46
|
-
}
|
1
|
+
// Adds $value at $index in $list
|
2
|
+
//
|
3
|
+
// @ignore Documentation: http://sassylists.com/documentation/#insert-nth
|
4
|
+
//
|
5
|
+
// @requires is-true
|
6
|
+
//
|
7
|
+
// @param {List} $list - list to update
|
8
|
+
// @param {Number} $index - index to add
|
9
|
+
// @param {*} $value - value to add
|
10
|
+
//
|
11
|
+
// @throws List index $index is not a number for `insert-nth`.
|
12
|
+
// @throws List index $index must be a non-zero integer for `insert-nth`.
|
13
|
+
//
|
14
|
+
// @return {List | Bool}
|
15
|
+
|
16
|
+
@function insert-nth($list, $index, $value) {
|
17
|
+
$length: length($list);
|
18
|
+
|
19
|
+
@if type-of($index) != number {
|
20
|
+
@warn "List index #{$index} is not a number for `insert-nth`.";
|
21
|
+
@return false;
|
22
|
+
}
|
23
|
+
|
24
|
+
@if $index < 1 {
|
25
|
+
@warn "List index #{$index} must be a non-zero integer for `insert-nth`.";
|
26
|
+
@return false;
|
27
|
+
}
|
28
|
+
|
29
|
+
@if $index > $length {
|
30
|
+
@return append($list, $value, list-separator($list));
|
31
|
+
}
|
32
|
+
|
33
|
+
$result: ();
|
34
|
+
|
35
|
+
@for $i from 1 through $length {
|
36
|
+
@if $i == $index {
|
37
|
+
@if is-true($value) {
|
38
|
+
$result: append($result, $value, list-separator($list));
|
39
|
+
}
|
40
|
+
}
|
41
|
+
|
42
|
+
$result: append($result, nth($list, $i), list-separator($list));
|
43
|
+
}
|
44
|
+
|
45
|
+
@return $result;
|
46
|
+
}
|
@@ -1,29 +1,29 @@
|
|
1
|
-
// Returns a list of shared value from $list and $lists minus duplicates
|
2
|
-
//
|
3
|
-
// @ignore Documentation: http://sassylists.com/documentation/#intersection
|
4
|
-
//
|
5
|
-
// @requires remove-duplicates
|
6
|
-
//
|
7
|
-
// @param {List} $list - first list
|
8
|
-
// @param {ArgList} $lists - other lists
|
9
|
-
//
|
10
|
-
// @return {List}
|
11
|
-
|
12
|
-
@function intersection($list, $lists...) {
|
13
|
-
$result: $list;
|
14
|
-
|
15
|
-
@each $list in $lists {
|
16
|
-
$temp: ();
|
17
|
-
|
18
|
-
@each $item in $result {
|
19
|
-
@if not not index($list, $item) {
|
20
|
-
$temp: append($temp, $item, list-separator($list));
|
21
|
-
}
|
22
|
-
}
|
23
|
-
|
24
|
-
$result: $temp;
|
25
|
-
}
|
26
|
-
|
27
|
-
$result: remove-duplicates($result);
|
28
|
-
@return if(length($result) == 1, nth($result, 1), $result);
|
1
|
+
// Returns a list of shared value from $list and $lists minus duplicates
|
2
|
+
//
|
3
|
+
// @ignore Documentation: http://sassylists.com/documentation/#intersection
|
4
|
+
//
|
5
|
+
// @requires remove-duplicates
|
6
|
+
//
|
7
|
+
// @param {List} $list - first list
|
8
|
+
// @param {ArgList} $lists - other lists
|
9
|
+
//
|
10
|
+
// @return {List}
|
11
|
+
|
12
|
+
@function intersection($list, $lists...) {
|
13
|
+
$result: $list;
|
14
|
+
|
15
|
+
@each $list in $lists {
|
16
|
+
$temp: ();
|
17
|
+
|
18
|
+
@each $item in $result {
|
19
|
+
@if not not index($list, $item) {
|
20
|
+
$temp: append($temp, $item, list-separator($list));
|
21
|
+
}
|
22
|
+
}
|
23
|
+
|
24
|
+
$result: $temp;
|
25
|
+
}
|
26
|
+
|
27
|
+
$result: remove-duplicates($result);
|
28
|
+
@return if(length($result) == 1, nth($result, 1), $result);
|
29
29
|
}
|
@@ -1,19 +1,19 @@
|
|
1
|
-
// Checks whether $list is symmetrical (one-level deep)
|
2
|
-
//
|
3
|
-
// @ignore Documentation: http://sassylists.com/documentation/#is-symmetrical
|
4
|
-
//
|
5
|
-
// @requires reverse
|
6
|
-
//
|
7
|
-
// @param {List} $list - list to check
|
8
|
-
//
|
9
|
-
// @return {Bool}
|
10
|
-
|
11
|
-
@function is-symmetrical($list) {
|
12
|
-
@return $list == reverse($list);
|
13
|
-
}
|
14
|
-
|
15
|
-
// @alias is-symmetrical
|
16
|
-
|
17
|
-
@function is-mirror($list) {
|
18
|
-
@return is-symmetrical($list);
|
1
|
+
// Checks whether $list is symmetrical (one-level deep)
|
2
|
+
//
|
3
|
+
// @ignore Documentation: http://sassylists.com/documentation/#is-symmetrical
|
4
|
+
//
|
5
|
+
// @requires reverse
|
6
|
+
//
|
7
|
+
// @param {List} $list - list to check
|
8
|
+
//
|
9
|
+
// @return {Bool}
|
10
|
+
|
11
|
+
@function is-symmetrical($list) {
|
12
|
+
@return $list == reverse($list);
|
13
|
+
}
|
14
|
+
|
15
|
+
// @alias is-symmetrical
|
16
|
+
|
17
|
+
@function is-mirror($list) {
|
18
|
+
@return is-symmetrical($list);
|
19
19
|
}
|
@@ -1,20 +1,20 @@
|
|
1
|
-
// Returns last index of $value in $list
|
2
|
-
//
|
3
|
-
// @ignore Documentation: http://sassylists.com/documentation/#last-index
|
4
|
-
//
|
5
|
-
// @param {List} $list - list to search
|
6
|
-
// @param {*} $value - value to be searched for
|
7
|
-
//
|
8
|
-
// @return {Number | Null}
|
9
|
-
|
10
|
-
@function last-index($list, $value) {
|
11
|
-
$length: length($list);
|
12
|
-
|
13
|
-
@for $i from $length through 1 {
|
14
|
-
@if nth($list, $i) == $value {
|
15
|
-
@return $i;
|
16
|
-
}
|
17
|
-
}
|
18
|
-
|
19
|
-
@return null;
|
20
|
-
}
|
1
|
+
// Returns last index of $value in $list
|
2
|
+
//
|
3
|
+
// @ignore Documentation: http://sassylists.com/documentation/#last-index
|
4
|
+
//
|
5
|
+
// @param {List} $list - list to search
|
6
|
+
// @param {*} $value - value to be searched for
|
7
|
+
//
|
8
|
+
// @return {Number | Null}
|
9
|
+
|
10
|
+
@function last-index($list, $value) {
|
11
|
+
$length: length($list);
|
12
|
+
|
13
|
+
@for $i from $length through 1 {
|
14
|
+
@if nth($list, $i) == $value {
|
15
|
+
@return $i;
|
16
|
+
}
|
17
|
+
}
|
18
|
+
|
19
|
+
@return null;
|
20
|
+
}
|
@@ -1,18 +1,18 @@
|
|
1
|
-
// Returns last element of $list
|
2
|
-
//
|
3
|
-
// @ignore Documentation: http://sassylists.com/documentation/#last
|
4
|
-
//
|
5
|
-
// @param {List} $list - list to retrieve last value from
|
6
|
-
//
|
7
|
-
// @throws Cannot find last item of empty list.
|
8
|
-
//
|
9
|
-
// @return {*}
|
10
|
-
|
11
|
-
@function last($list) {
|
12
|
-
@if length($list) == 0 {
|
13
|
-
@warn "Cannot find last item of empty list.";
|
14
|
-
@return false;
|
15
|
-
}
|
16
|
-
|
17
|
-
@return nth($list, -1);
|
1
|
+
// Returns last element of $list
|
2
|
+
//
|
3
|
+
// @ignore Documentation: http://sassylists.com/documentation/#last
|
4
|
+
//
|
5
|
+
// @param {List} $list - list to retrieve last value from
|
6
|
+
//
|
7
|
+
// @throws Cannot find last item of empty list.
|
8
|
+
//
|
9
|
+
// @return {*}
|
10
|
+
|
11
|
+
@function last($list) {
|
12
|
+
@if length($list) == 0 {
|
13
|
+
@warn "Cannot find last item of empty list.";
|
14
|
+
@return false;
|
15
|
+
}
|
16
|
+
|
17
|
+
@return nth($list, -1);
|
18
18
|
}
|
@@ -1,36 +1,36 @@
|
|
1
|
-
// Shift indexes from $list of $value
|
2
|
-
//
|
3
|
-
// @ignore Documentation: http://sassylists.com/documentation/#loop
|
4
|
-
//
|
5
|
-
// @param {List} $list - list to update
|
6
|
-
// @param {Number} $value (1) - number of position between old and new indexes
|
7
|
-
//
|
8
|
-
// @throws $value is not a number for `loop`.
|
9
|
-
//
|
10
|
-
// @return {List | Bool}
|
11
|
-
|
12
|
-
@function loop($list, $value: 1) {
|
13
|
-
@if type-of($value) != "number" {
|
14
|
-
@warn "#{$value} is not a number for `loop`.";
|
15
|
-
@return false;
|
16
|
-
}
|
17
|
-
|
18
|
-
@if length($list) < 2 {
|
19
|
-
@return $list;
|
20
|
-
}
|
21
|
-
|
22
|
-
$result: ();
|
23
|
-
$length: length($list);
|
24
|
-
|
25
|
-
@for $i from 0 to $length {
|
26
|
-
$result: append($result, nth($list, ($i - $value) % $length + 1), list-separator($list));
|
27
|
-
}
|
28
|
-
|
29
|
-
@return $result;
|
30
|
-
}
|
31
|
-
|
32
|
-
// @alias shift-indexes
|
33
|
-
|
34
|
-
@function shift-indexes($list, $value: 1) {
|
35
|
-
@return loop($list, $value);
|
1
|
+
// Shift indexes from $list of $value
|
2
|
+
//
|
3
|
+
// @ignore Documentation: http://sassylists.com/documentation/#loop
|
4
|
+
//
|
5
|
+
// @param {List} $list - list to update
|
6
|
+
// @param {Number} $value (1) - number of position between old and new indexes
|
7
|
+
//
|
8
|
+
// @throws $value is not a number for `loop`.
|
9
|
+
//
|
10
|
+
// @return {List | Bool}
|
11
|
+
|
12
|
+
@function loop($list, $value: 1) {
|
13
|
+
@if type-of($value) != "number" {
|
14
|
+
@warn "#{$value} is not a number for `loop`.";
|
15
|
+
@return false;
|
16
|
+
}
|
17
|
+
|
18
|
+
@if length($list) < 2 {
|
19
|
+
@return $list;
|
20
|
+
}
|
21
|
+
|
22
|
+
$result: ();
|
23
|
+
$length: length($list);
|
24
|
+
|
25
|
+
@for $i from 0 to $length {
|
26
|
+
$result: append($result, nth($list, ($i - $value) % $length + 1), list-separator($list));
|
27
|
+
}
|
28
|
+
|
29
|
+
@return $result;
|
30
|
+
}
|
31
|
+
|
32
|
+
// @alias shift-indexes
|
33
|
+
|
34
|
+
@function shift-indexes($list, $value: 1) {
|
35
|
+
@return loop($list, $value);
|
36
36
|
}
|
@@ -1,20 +1,20 @@
|
|
1
|
-
// Adds $value as first index of $list
|
2
|
-
//
|
3
|
-
// @ignore Documentation: http://sassylists.com/documentation/#prepend
|
4
|
-
//
|
5
|
-
// @requires is-true
|
6
|
-
//
|
7
|
-
// @param {List} $list - list to preprend value to
|
8
|
-
// @param {*} $value - value to prepend to the list
|
9
|
-
//
|
10
|
-
// @return {List}
|
11
|
-
|
12
|
-
@function prepend($list, $value) {
|
13
|
-
@if is-true($value) {
|
14
|
-
@return join($value, $list, list-separator($list));
|
15
|
-
}
|
16
|
-
|
17
|
-
@else {
|
18
|
-
@return $list;
|
19
|
-
}
|
20
|
-
}
|
1
|
+
// Adds $value as first index of $list
|
2
|
+
//
|
3
|
+
// @ignore Documentation: http://sassylists.com/documentation/#prepend
|
4
|
+
//
|
5
|
+
// @requires is-true
|
6
|
+
//
|
7
|
+
// @param {List} $list - list to preprend value to
|
8
|
+
// @param {*} $value - value to prepend to the list
|
9
|
+
//
|
10
|
+
// @return {List}
|
11
|
+
|
12
|
+
@function prepend($list, $value) {
|
13
|
+
@if is-true($value) {
|
14
|
+
@return join($value, $list, list-separator($list));
|
15
|
+
}
|
16
|
+
|
17
|
+
@else {
|
18
|
+
@return $list;
|
19
|
+
}
|
20
|
+
}
|
@@ -1,27 +1,27 @@
|
|
1
|
-
// Removes all false and null values from $list
|
2
|
-
//
|
3
|
-
// @ignore Documentation: http://sassylists.com/documentation.html#purge
|
4
|
-
//
|
5
|
-
// @requires is-true
|
6
|
-
//
|
7
|
-
// @param {List} $list - list to purge
|
8
|
-
//
|
9
|
-
// @return {List}
|
10
|
-
|
11
|
-
@function purge($list) {
|
12
|
-
$result: ();
|
13
|
-
|
14
|
-
@each $item in $list {
|
15
|
-
@if is-true($item) {
|
16
|
-
$result: append($result, $item, list-separator($list));
|
17
|
-
}
|
18
|
-
}
|
19
|
-
|
20
|
-
@return $result;
|
21
|
-
}
|
22
|
-
|
23
|
-
// @alias purge
|
24
|
-
|
25
|
-
@function clean($list) {
|
26
|
-
@return purge($list);
|
27
|
-
}
|
1
|
+
// Removes all false and null values from $list
|
2
|
+
//
|
3
|
+
// @ignore Documentation: http://sassylists.com/documentation.html#purge
|
4
|
+
//
|
5
|
+
// @requires is-true
|
6
|
+
//
|
7
|
+
// @param {List} $list - list to purge
|
8
|
+
//
|
9
|
+
// @return {List}
|
10
|
+
|
11
|
+
@function purge($list) {
|
12
|
+
$result: ();
|
13
|
+
|
14
|
+
@each $item in $list {
|
15
|
+
@if is-true($item) {
|
16
|
+
$result: append($result, $item, list-separator($list));
|
17
|
+
}
|
18
|
+
}
|
19
|
+
|
20
|
+
@return $result;
|
21
|
+
}
|
22
|
+
|
23
|
+
// @alias purge
|
24
|
+
|
25
|
+
@function clean($list) {
|
26
|
+
@return purge($list);
|
27
|
+
}
|
@@ -1,30 +1,30 @@
|
|
1
|
-
// Returns a random value of $list
|
2
|
-
//
|
3
|
-
// @ignore Documentation: http://sassylists.com/documentation.html#random-value
|
4
|
-
//
|
5
|
-
// @param {List} $list - list to random value from
|
6
|
-
//
|
7
|
-
// @throws Cannot find a random value in an empty list.
|
8
|
-
//
|
9
|
-
// @return {*}
|
10
|
-
|
11
|
-
@function random-value($list) {
|
12
|
-
@if length($list) == 0 {
|
13
|
-
@warn "Cannot find a random value in an empty list.";
|
14
|
-
@return false;
|
15
|
-
}
|
16
|
-
|
17
|
-
@return nth($list, random(length($list)) + 1);
|
18
|
-
}
|
19
|
-
|
20
|
-
// @alias random-value
|
21
|
-
|
22
|
-
@function roll($list) {
|
23
|
-
@return random-value($list);
|
24
|
-
}
|
25
|
-
|
26
|
-
// @alias random-value
|
27
|
-
|
28
|
-
@function luck($list) {
|
29
|
-
@return random-value($list);
|
1
|
+
// Returns a random value of $list
|
2
|
+
//
|
3
|
+
// @ignore Documentation: http://sassylists.com/documentation.html#random-value
|
4
|
+
//
|
5
|
+
// @param {List} $list - list to random value from
|
6
|
+
//
|
7
|
+
// @throws Cannot find a random value in an empty list.
|
8
|
+
//
|
9
|
+
// @return {*}
|
10
|
+
|
11
|
+
@function random-value($list) {
|
12
|
+
@if length($list) == 0 {
|
13
|
+
@warn "Cannot find a random value in an empty list.";
|
14
|
+
@return false;
|
15
|
+
}
|
16
|
+
|
17
|
+
@return nth($list, random(length($list)) + 1);
|
18
|
+
}
|
19
|
+
|
20
|
+
// @alias random-value
|
21
|
+
|
22
|
+
@function roll($list) {
|
23
|
+
@return random-value($list);
|
24
|
+
}
|
25
|
+
|
26
|
+
// @alias random-value
|
27
|
+
|
28
|
+
@function luck($list) {
|
29
|
+
@return random-value($list);
|
30
30
|
}
|
@@ -1,25 +1,25 @@
|
|
1
|
-
// Removes duplicate values from $list
|
2
|
-
//
|
3
|
-
// @ignore Documentation: http://sassylists.com/documentation/#remove-duplicates
|
4
|
-
//
|
5
|
-
// @param {List} $list - list to remove duplicates from
|
6
|
-
//
|
7
|
-
// @return {List}
|
8
|
-
|
9
|
-
@function remove-duplicates($list) {
|
10
|
-
$result: ();
|
11
|
-
|
12
|
-
@each $item in $list {
|
13
|
-
@if not index($result, $item) {
|
14
|
-
$result: append($result, $item, list-separator($list));
|
15
|
-
}
|
16
|
-
}
|
17
|
-
|
18
|
-
@return $result;
|
19
|
-
}
|
20
|
-
|
21
|
-
// @alias remove-duplicates
|
22
|
-
|
23
|
-
@function unique($list
|
24
|
-
@return remove-duplicates($list
|
1
|
+
// Removes duplicate values from $list
|
2
|
+
//
|
3
|
+
// @ignore Documentation: http://sassylists.com/documentation/#remove-duplicates
|
4
|
+
//
|
5
|
+
// @param {List} $list - list to remove duplicates from
|
6
|
+
//
|
7
|
+
// @return {List}
|
8
|
+
|
9
|
+
@function remove-duplicates($list) {
|
10
|
+
$result: ();
|
11
|
+
|
12
|
+
@each $item in $list {
|
13
|
+
@if not index($result, $item) {
|
14
|
+
$result: append($result, $item, list-separator($list));
|
15
|
+
}
|
16
|
+
}
|
17
|
+
|
18
|
+
@return $result;
|
19
|
+
}
|
20
|
+
|
21
|
+
// @alias remove-duplicates
|
22
|
+
|
23
|
+
@function unique($list) {
|
24
|
+
@return remove-duplicates($list);
|
25
25
|
}
|
@@ -1,20 +1,20 @@
|
|
1
|
-
// Removes value from $list at index $index
|
2
|
-
//
|
3
|
-
// @ignore Documentation: http://sassylists.com/documentation/#remove-nth
|
4
|
-
//
|
5
|
-
// @requires replace-nth
|
6
|
-
//
|
7
|
-
// @param {List} $list - list to remove value from
|
8
|
-
// @param {Number} $index - index to remove
|
9
|
-
//
|
10
|
-
// @return {List | Bool}
|
11
|
-
|
12
|
-
@function remove-nth($list, $index) {
|
13
|
-
@return replace-nth($list, $index, "");
|
14
|
-
}
|
15
|
-
|
16
|
-
// @alias remove-nth
|
17
|
-
|
18
|
-
@function without-nth($list, $index) {
|
19
|
-
@return remove-nth($list, $index);
|
1
|
+
// Removes value from $list at index $index
|
2
|
+
//
|
3
|
+
// @ignore Documentation: http://sassylists.com/documentation/#remove-nth
|
4
|
+
//
|
5
|
+
// @requires replace-nth
|
6
|
+
//
|
7
|
+
// @param {List} $list - list to remove value from
|
8
|
+
// @param {Number} $index - index to remove
|
9
|
+
//
|
10
|
+
// @return {List | Bool}
|
11
|
+
|
12
|
+
@function remove-nth($list, $index) {
|
13
|
+
@return replace-nth($list, $index, "");
|
14
|
+
}
|
15
|
+
|
16
|
+
// @alias remove-nth
|
17
|
+
|
18
|
+
@function without-nth($list, $index) {
|
19
|
+
@return remove-nth($list, $index);
|
20
20
|
}
|