SassyLists 2.2.1 → 2.2.2

Sign up to get free protection for your applications and to get access to all the features.
Files changed (49) hide show
  1. checksums.yaml +4 -4
  2. data/CHANGELOG.md +1 -0
  3. data/README.md +1 -1
  4. data/lib/SassyLists.rb +2 -2
  5. data/stylesheets/SassyLists/_chunk.scss +15 -13
  6. data/stylesheets/SassyLists/_comma-list.scss +7 -5
  7. data/stylesheets/SassyLists/_contain.scss +15 -11
  8. data/stylesheets/SassyLists/_count-values.scss +10 -8
  9. data/stylesheets/SassyLists/_debug.scss +22 -18
  10. data/stylesheets/SassyLists/_every.scss +12 -8
  11. data/stylesheets/SassyLists/_explode.scss +15 -13
  12. data/stylesheets/SassyLists/_first.scss +17 -14
  13. data/stylesheets/SassyLists/_flatten.scss +16 -12
  14. data/stylesheets/SassyLists/_has-multiple-values.scss +10 -8
  15. data/stylesheets/SassyLists/_has-values.scss +9 -8
  16. data/stylesheets/SassyLists/_insert-nth.scss +16 -15
  17. data/stylesheets/SassyLists/_intersection.scss +14 -12
  18. data/stylesheets/SassyLists/_is-empty.scss +14 -10
  19. data/stylesheets/SassyLists/_is-single.scss +10 -8
  20. data/stylesheets/SassyLists/_is-symmetrical.scss +16 -12
  21. data/stylesheets/SassyLists/_last-index.scss +11 -9
  22. data/stylesheets/SassyLists/_last.scss +14 -12
  23. data/stylesheets/SassyLists/_loop.scss +21 -17
  24. data/stylesheets/SassyLists/_prepend.scss +14 -12
  25. data/stylesheets/SassyLists/_purge.scss +16 -13
  26. data/stylesheets/SassyLists/_random-value.scss +22 -16
  27. data/stylesheets/SassyLists/_range.scss +14 -12
  28. data/stylesheets/SassyLists/_remove-duplicates.scss +16 -12
  29. data/stylesheets/SassyLists/_remove-nth.scss +17 -13
  30. data/stylesheets/SassyLists/_remove.scss +18 -14
  31. data/stylesheets/SassyLists/_replace-nth.scss +18 -16
  32. data/stylesheets/SassyLists/_replace.scss +16 -14
  33. data/stylesheets/SassyLists/_reverse.scss +16 -12
  34. data/stylesheets/SassyLists/_shuffle.scss +16 -12
  35. data/stylesheets/SassyLists/_slice.scss +18 -16
  36. data/stylesheets/SassyLists/_some.scss +11 -7
  37. data/stylesheets/SassyLists/_sort.scss +19 -15
  38. data/stylesheets/SassyLists/_sum.scss +16 -14
  39. data/stylesheets/SassyLists/_tail.scss +16 -12
  40. data/stylesheets/SassyLists/_to-list.scss +15 -15
  41. data/stylesheets/SassyLists/_to-map.scss +31 -24
  42. data/stylesheets/SassyLists/_to-string.scss +18 -14
  43. data/stylesheets/SassyLists/_union.scss +17 -12
  44. data/stylesheets/SassyLists/_walk.scss +17 -15
  45. data/stylesheets/SassyLists/helpers/_is-number.scss +10 -8
  46. data/stylesheets/SassyLists/helpers/_missing-dependencies.scss +10 -8
  47. data/stylesheets/SassyLists/helpers/_str-compare.scss +12 -10
  48. data/stylesheets/SassyLists/helpers/_true.scss +10 -8
  49. metadata +2 -2
@@ -1,19 +1,21 @@
1
- // Replaces value at `$index` from `$list` by `$value`.
2
- //
3
- // @ignore Documentation: http://sassylists.com/documentation.html#sl-replace-nth
4
- //
5
- // @requires sl-purge
6
- // @requires sl-is-true
7
- // @requires sl-to-list
8
- //
9
- // @param {List} $list - list to update
10
- // @param {Number} $index - index to update
11
- // @param {*} $value - new value for index
12
- //
13
- // @throws Invalid index $index for `sl-replace-nth`.
14
- //
15
- // @return {List | Null}
16
-
1
+ /**
2
+ * Replaces value at `$index` from `$list` by `$value`.
3
+ *
4
+ * @ignore Documentation: http://sassylists.com/documentation.html#sl-replace-nth
5
+ *
6
+ * @requires sl-purge
7
+ * @requires sl-is-true
8
+ * @requires sl-to-list
9
+ *
10
+ * @param {List} $list - list to update
11
+ * @param {Number} $index - index to update
12
+ * @param {*} $value - new value for index
13
+ *
14
+ * @throws Invalid index $index for `sl-replace-nth`.
15
+ *
16
+ * @return {List | Null}
17
+ */
18
+
17
19
  @function sl-replace-nth($list, $index, $value) {
18
20
  @if sl-missing-dependencies(sl-purge, sl-is-true, sl-to-list) == true { @return null; }
19
21
 
@@ -1,17 +1,19 @@
1
- // Replaces `$old` by `$new` in `$list`.
2
- //
3
- // @ignore Documentation: http://sassylists.com/documentation.html#replace
4
- //
5
- // @requires sl-is-true
6
- // @requires sl-purge
7
- // @requires sl-to-list
8
- //
9
- // @param {List} $list - list to update
10
- // @param {*} $old - value to replace
11
- // @param {*} $value - new value for $old
12
- //
13
- // @return {List}
14
-
1
+ /**
2
+ * Replaces `$old` by `$new` in `$list`.
3
+ *
4
+ * @ignore Documentation: http://sassylists.com/documentation.html#replace
5
+ *
6
+ * @requires sl-is-true
7
+ * @requires sl-purge
8
+ * @requires sl-to-list
9
+ *
10
+ * @param {List} $list - list to update
11
+ * @param {*} $old - value to replace
12
+ * @param {*} $value - new value for $old
13
+ *
14
+ * @return {List}
15
+ */
16
+
15
17
  @function sl-replace($list, $old, $value) {
16
18
  @if sl-missing-dependencies(sl-is-true, sl-purge, sl-to-list) == true { @return null; }
17
19
 
@@ -1,12 +1,14 @@
1
- // Reverses the order of `$list`.
2
- //
3
- // @ignore Documentation: http://sassylists.com/documentation.html#sl-reverse
4
- //
5
- // @param {List} $list - list to reverse
6
- //
7
- // @requires sl-to-list
8
- //
9
- // @return {List}
1
+ /**
2
+ * Reverses the order of `$list`.
3
+ *
4
+ * @ignore Documentation: http://sassylists.com/documentation.html#sl-reverse
5
+ *
6
+ * @param {List} $list - list to reverse
7
+ *
8
+ * @requires sl-to-list
9
+ *
10
+ * @return {List}
11
+ */
10
12
 
11
13
  @function sl-reverse($list) {
12
14
  @if sl-missing-dependencies(sl-to-list) == true { @return null; }
@@ -27,9 +29,11 @@
27
29
  @return sl-to-list($list);
28
30
  }
29
31
 
30
- // @requires sl-reverse
31
- // @alias sl-reverse
32
-
32
+ /**
33
+ * @requires sl-reverse
34
+ * @alias sl-reverse
35
+ */
36
+
33
37
  @function sl-mirror($list) {
34
38
  @return sl-reverse($list);
35
39
  }
@@ -1,12 +1,14 @@
1
- // Shuffle `$list` using Fisher-Yates method.
2
- //
3
- // @ignore Documentation: http://sassylists.com/documentation.html#sl-shuffle
4
- //
5
- // @param {List} $list - list to shuffle
6
- //
7
- // @requires sl-to-list
8
- //
9
- // @return {List}
1
+ /**
2
+ * Shuffle `$list` using Fisher-Yates method.
3
+ *
4
+ * @ignore Documentation: http://sassylists.com/documentation.html#sl-shuffle
5
+ *
6
+ * @param {List} $list - list to shuffle
7
+ *
8
+ * @requires sl-to-list
9
+ *
10
+ * @return {List}
11
+ */
10
12
 
11
13
  @function sl-shuffle($list) {
12
14
  @if sl-missing-dependencies(sl-to-list) == true { @return null; }
@@ -27,9 +29,11 @@
27
29
  @return sl-to-list($list);
28
30
  }
29
31
 
30
- // @requires sl-shuffle
31
- // @alias sl-shuffle
32
-
32
+ /**
33
+ * @requires sl-shuffle
34
+ * @alias sl-shuffle
35
+ */
36
+
33
37
  @function sl-randomize($list) {
34
38
  @return sl-shuffle($list);
35
39
  }
@@ -1,19 +1,21 @@
1
- // Slices `$list` between `$start` and `$end`.
2
- //
3
- // @ignore Documentation: http://sassylists.com/documentation.html#sl-slice
4
- //
5
- // @param {List} $list - list to slice
6
- // @param {Number} $start (1) - start index
7
- // @param {Number} $end (length($list)) - end index
8
- //
9
- // @throws List indexes $start and $end must be numbers for `sl-slice`.
10
- // @throws Start index has to be lesser than or equals to the end index for `sl-slice`.
11
- // @throws List indexes must be non-zero integers for `sl-slice`.
12
- // @throws Start index has to be lesser than or equal to list length for `sl-slice`.
13
- // @throws End index has to be lesser than or equal to list length for `sl-slice`.
14
- //
15
- // @return {List | Null}
16
-
1
+ /**
2
+ * Slices `$list` between `$start` and `$end`.
3
+ *
4
+ * @ignore Documentation: http://sassylists.com/documentation.html#sl-slice
5
+ *
6
+ * @param {List} $list - list to slice
7
+ * @param {Number} $start (1) - start index
8
+ * @param {Number} $end (length($list)) - end index
9
+ *
10
+ * @throws List indexes $start and $end must be numbers for `sl-slice`.
11
+ * @throws Start index has to be lesser than or equals to the end index for `sl-slice`.
12
+ * @throws List indexes must be non-zero integers for `sl-slice`.
13
+ * @throws Start index has to be lesser than or equal to list length for `sl-slice`.
14
+ * @throws End index has to be lesser than or equal to list length for `sl-slice`.
15
+ *
16
+ * @return {List | Null}
17
+ */
18
+
17
19
  @function sl-slice($list, $start: 1, $end: length($list)) {
18
20
  @if type-of($start) != "number" or type-of($end) != "number" {
19
21
  @warn "List indexes #{$start} and #{$end} must be numbers for `sl-slice`.";
@@ -1,10 +1,14 @@
1
- // Tests whether some items from `$list` pass the test implemented by `$function`.
2
- //
3
- // @param {List} $list - list to run test against
4
- // @param {String} $function - function to run against every item from list
5
- // @param {ArgList} $args - extra arguments to pass to the function
6
- //
7
- // @return {Bool}
1
+ /**
2
+ * Tests whether some items from `$list` pass the test implemented by `$function`.
3
+ *
4
+ * @ignore Documentation: http://sassylists.com/documentation.html#sl-some
5
+ *
6
+ * @param {List} $list - list to run test against
7
+ * @param {String} $function - function to run against every item from list
8
+ * @param {ArgList} $args - extra arguments to pass to the function
9
+ *
10
+ * @return {Bool}
11
+ */
8
12
 
9
13
  @function sl-some($list, $function, $args...) {
10
14
  @each $item in $list {
@@ -1,15 +1,17 @@
1
- // Sorts values of `$list` using quick-sort algorithm using `$order`.
2
- //
3
- // @ignore Documentation: http://sassylists.com/documentation.html#sl-sort
4
- //
5
- // @requires sl-str-compare
6
- // @requires sl-has-multiple-values
7
- // @requires sl-to-list
8
- //
9
- // @param {List} $list - list to sort
10
- // @param {List} $order - order to respect
11
- //
12
- // @return {List}
1
+ /**
2
+ * Sorts values of `$list` using quick-sort algorithm using `$order`.
3
+ *
4
+ * @ignore Documentation: http://sassylists.com/documentation.html#sl-sort
5
+ *
6
+ * @requires sl-str-compare
7
+ * @requires sl-has-multiple-values
8
+ * @requires sl-to-list
9
+ *
10
+ * @param {List} $list - list to sort
11
+ * @param {List} $order - order to respect
12
+ *
13
+ * @return {List}
14
+ */
13
15
 
14
16
  @function sl-sort($list, $order: "!" "#" "$" "%" "&" "'" "(" ")" "*" "+" "," "-" "." "/" "[" "\\" "]" "^" "_" "{" "|" "}" "~" "0" "1" "2" "3" "4" "5" "6" "7" "8" "9" "a" "b" "c" "d" "e" "f" "g" "h" "i" "j" "k" "l" "m" "n" "o" "p" "q" "r" "s" "t" "u" "v" "w" "x" "y" "z") {
15
17
  @if sl-missing-dependencies(sl-str-compare, sl-has-multiple-values, sl-to-list) == true { @return null; }
@@ -41,9 +43,11 @@
41
43
  @return sl-to-list($list);
42
44
  }
43
45
 
44
- // @requires sl-sort
45
- // @alias sl-sort
46
-
46
+ /**
47
+ * @requires sl-sort
48
+ * @alias sl-sort
49
+ */
50
+
47
51
  @function sl-order($list) {
48
52
  @return sl-sort($list);
49
53
  }
@@ -1,17 +1,19 @@
1
- // Sums up all numeric values in `$list`, stripping unit if `$force` set to `true`.
2
- //
3
- // @ignore Documentation: http://sassylists.com/documentation.html#sl-sum
4
- //
5
- // @param {List} $list - list
6
- // @param {Bool} $force (false) - enable/disable parseInt
7
- //
8
- // @requires sl-every
9
- // @requires sl-is-number
10
- //
11
- // @throws All items from list are not numbers for `sl-sum`.
12
- //
13
- // @return {Number}
14
-
1
+ /**
2
+ * Sums up all numeric values in `$list`, stripping unit if `$force` set to `true`.
3
+ *
4
+ * @ignore Documentation: http://sassylists.com/documentation.html#sl-sum
5
+ *
6
+ * @param {List} $list - list
7
+ * @param {Bool} $force (false) - enable/disable parseInt
8
+ *
9
+ * @requires sl-every
10
+ * @requires sl-is-number
11
+ *
12
+ * @throws All items from list are not numbers for `sl-sum`.
13
+ *
14
+ * @return {Number}
15
+ */
16
+
15
17
  @function sl-sum($list, $force: false) {
16
18
  $result: 0;
17
19
 
@@ -1,21 +1,25 @@
1
- // Returns the tail of `$list`: all items except the first (head).
2
- //
3
- // @ignore Documentation: http://sassylists.com/documentation.html#sl-tail
4
- //
5
- // @requires sl-slice
6
- //
7
- // @param {List} $list - list to retrieve tail from
8
- //
9
- // @return {List | Null}
10
-
1
+ /**
2
+ * Returns the tail of `$list`: all items except the first (head).
3
+ *
4
+ * @ignore Documentation: http://sassylists.com/documentation.html#sl-tail
5
+ *
6
+ * @requires sl-slice
7
+ *
8
+ * @param {List} $list - list to retrieve tail from
9
+ *
10
+ * @return {List | Null}
11
+ */
12
+
11
13
  @function sl-tail($list) {
12
14
  @if sl-missing-dependencies(sl-slice) == true { @return null; }
13
15
 
14
16
  @return sl-slice($list, 2);
15
17
  }
16
18
 
17
- // @requires sl-tail
18
- // @alias sl-tail
19
+ /**
20
+ * @requires sl-tail
21
+ * @alias sl-tail
22
+ */
19
23
 
20
24
  @function sl-rest($list) {
21
25
  @return sl-tail($list);
@@ -1,22 +1,22 @@
1
- // Casts `$value` into a list.
2
- //
3
- // @ignore Documentation: http://sassylists.com/documentation.html#sl-to-list
4
- //
5
- // @param {*} $value - value to cast to list
6
- // @param {String} $separator (space) - separator to use
7
- //
8
- // @return {List}
1
+ /**
2
+ * Casts `$value` into a list.
3
+ *
4
+ * @ignore Documentation: http://sassylists.com/documentation.html#sl-to-list
5
+ *
6
+ * @param {*} $value - value to cast to list
7
+ * @param {String} $separator (space) - separator to use
8
+ *
9
+ * @return {List}
10
+ */
9
11
 
10
12
  @function sl-to-list($value, $separator: list-separator($value)) {
11
- @if type-of($value) != "list" or list-separator($value) != $separator {
12
- @return join((), $value, $separator);
13
- }
14
-
15
- @return $value;
13
+ @return join((), $value, $separator);
16
14
  }
17
15
 
18
- // @requires sl-to-list
19
- // @alias sl-to-list
16
+ /**
17
+ * @requires sl-to-list
18
+ * @alias sl-to-list
19
+ */
20
20
 
21
21
  @function sl-listify($value) {
22
22
  @return sl-to-list($value);
@@ -1,19 +1,22 @@
1
- // Casts `$list` into a map, using indexes as keys (starting with `$start`).
2
- // Useful for iterating through a list with an index variable.
3
- // e.g. `@each $index, $value in to-map($list)`
4
- //
5
- // @author Andrey "Lolmaus" Mikhaylov and Chris Eppstein
6
- //
7
- // @ignore Documentation: http://sassylists.com/documentation.html#sl-to-map
8
- //
9
- // @param {List} $list - list to turn into map
10
- //
11
- // @requires sl-range
12
- // @requires sl-is-empty
13
- //
14
- // @throws List cannot be empty for `sl-to-map`.
15
- //
16
- // @return {Map | Null}
1
+ /**
2
+ * Casts `$list` into a map, using indexes as keys (starting with `$start`).
3
+ * Useful for iterating through a list with an index variable.
4
+ * e.g. `@each $index, $value in to-map($list)`
5
+ *
6
+ * @author Andrey "Lolmaus" Mikhaylov
7
+ * @author Chris Eppstein
8
+ *
9
+ * @ignore Documentation: http://sassylists.com/documentation.html#sl-to-map
10
+ *
11
+ * @param {List} $list - list to turn into map
12
+ *
13
+ * @requires sl-range
14
+ * @requires sl-is-empty
15
+ *
16
+ * @throws List cannot be empty for `sl-to-map`.
17
+ *
18
+ * @return {Map | Null}
19
+ */
17
20
 
18
21
  @function sl-to-map($list) {
19
22
  @if sl-missing-dependencies(sl-range, sl-is-empty) == true { @return null; }
@@ -26,16 +29,20 @@
26
29
  @return zip(sl-range(length($list)), $list);
27
30
  }
28
31
 
29
- // @requires sl-to-map
30
- // @alias sl-to-map
32
+ /**
33
+ * @requires sl-to-map
34
+ * @alias sl-to-map
35
+ */
31
36
 
32
- @function sl-enumerate($list, $start: 1) {
33
- @return sl-to-map($list, $start);
37
+ @function sl-enumerate($list) {
38
+ @return sl-to-map($list);
34
39
  }
35
40
 
36
- // @requires sl-to-map
37
- // @alias sl-to-map
41
+ /**
42
+ * @requires sl-to-map
43
+ * @alias sl-to-map
44
+ */
38
45
 
39
- @function sl-mapify($list, $start: 1) {
40
- @return sl-to-map($list, $start);
46
+ @function sl-mapify($list) {
47
+ @return sl-to-map($list);
41
48
  }
@@ -1,14 +1,16 @@
1
- // Joins all elements of `$list` with `$glue`.
2
- //
3
- // @ignore Documentation: http://sassylists.com/documentation.html#sl-to-string
4
- //
5
- // @param {List} $list - list to cast
6
- // @param {String} $glue ('') - value to use as a join string
7
- //
8
- // @requires sl-has-multiple-values
9
- // @requires sl-last
10
- //
11
- // @return {String}
1
+ /**
2
+ * Joins all elements of `$list` with `$glue`.
3
+ *
4
+ * @ignore Documentation: http://sassylists.com/documentation.html#sl-to-string
5
+ *
6
+ * @param {List} $list - list to cast
7
+ * @param {String} $glue ('') - value to use as a join string
8
+ *
9
+ * @requires sl-has-multiple-values
10
+ * @requires sl-last
11
+ *
12
+ * @return {String}
13
+ */
12
14
 
13
15
  @function sl-to-string($list, $glue: '') {
14
16
  @if sl-missing-dependencies(sl-has-multiple-values) == true { @return null; }
@@ -26,9 +28,11 @@
26
28
  @return quote($result);
27
29
  }
28
30
 
29
- // @requires sl-to-string
30
- // @alias sl-to-string
31
-
31
+ /**
32
+ * @requires sl-to-string
33
+ * @alias sl-to-string
34
+ */
35
+
32
36
  @function sl-stringify($list, $glue: '') {
33
37
  @return sl-to-string($list, $glue);
34
38
  }